I have been struggling with the same issue for some time now and i finally found the solution.
I use Ubuntu 14.04.1 LTS and have compiled php 5.4.31 with the following options:
configoptions="\ --enable-bcmath \ --enable-calendar \ --enable-exif \ --enable-ftp \ --enable-mbstring \ --enable-pcntl \ --with-mysqli=/usr/bin/mysql_config \ --enable-soap \ --enable-sockets \ --enable-wddx \ --enable-zip \ --with-libdir=lib/i386-linux-gnu \ --with-gd \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-curl \ --with-mysql \ --with-pdo_mysql \ --with-openssl \ --enable-xml \ --with-zlib \ --with-zlib-dir=/usr \ --with-gettext \ --enable-zip \ --enable-gd-native-ttf \ --with-freetype-dir=/usr/include/freetype2/freetype \ --with-t1lib \
GD was enabled, but JPEG support was not, even after i tried numerous suggestions on other fora.
The solution was very simple:
- go to the source directory: cd /opt/phpfarm/src/php-5.4.31
- make clean
- cd ..
- ./compile.sh 5.4.31
- Party :)
This worked for me, hope it works for you!