Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gd installed, but "Call to undefined function imagecreatefromjpeg()"

Tags:

php

gd

Looks like my hosting has gd support, but i still get an error ( PHP Version 5.3.28 )

Fatal error: Call to undefined function imagecreatefromjpeg()

Here is my phpinfo:

gd

GD Support  enabled
GD Version  bundled (2.1.0 compatible)
GIF Read Support    enabled
GIF Create Support  enabled
PNG Support enabled
libPNG Version  1.2.44
WBMP Support    enabled
XBM Support enabled

Directive   Local Value Master Value
gd.jpeg_ignore_warning  0   0
like image 344
Yegor Razumovsky Avatar asked Jun 02 '14 06:06

Yegor Razumovsky


Video Answer


1 Answers

It appears that while GD is indeed supported that it was not compiled with libjpeg. The gd.jpeg_ignore_warning does not mean that you have jpeg support. If this is your own server make sure to run configure with --with-jpeg-dir. You may have to search for it. I used the command find / -name libjpeg* and got /usr/lib for CentOS5. If this a shared host have them install it for you.

My complete compilation of PHP is as follows:

wget http://us1.php.net/distributions/php-5.5.10.tar.gz -O php.tar.gz 
tar -xvf php.tar.gz
cd php-5.5.10
yum -y install libxml2-devel libmcrypt-devel libpng-devel
./configure --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d  --with-apxs2 --with-mysql --with-mysqli --with-zlib --with-curl --with-libdir=lib --with-openssl --with-pdo-mysql --with-mcrypt  --with-pcre-regex --enable-zip --with-gd --enable-mbstring --with-jpeg-dir=/usr/lib
make clean
make 
make install
like image 53
Travis Pessetto Avatar answered Sep 28 '22 11:09

Travis Pessetto