Compile PHP 5.1 with JPEG support on Debian


Ok, here’s my configure command:

 ./configure 
--with-apxs2=/path/to/httpd/bin/apxs  
--with-mysql=/path/to/mysql  
--with-mysql-sock=/tmp/mysql.sock  
--prefix=/path/to/httpd/php  
--with-config-file-path=/path/to/httpd/php  
--enable-force-cgi-redirect  
--disable-cgi  
--with-zlib  
--with-gettext  
--with-gdbm  
--with-gd  
--with-png  
--with-png-dir=/usr/lib  
--with-jpeg  
--with-jpeg-dir=/usr/lib  
--with-pdo-mysql  
--with-mysqli

I ran into errors trying to run the function imagecreatefromjpeg and imagesx and imagesy. And the system could not find the jpeg libs. On Debian Sarge, you need to run an apt-get install libjpeg62-dev. Also, I ran configure with just the –with-jpeg switch, and it didn’t work. So, I had to also include the –with-jpeg-dir=/path/to/lib. On Debian is was in /usr/lib. After that, it all worked out.

It’s worth noting, you must have libpng, libjpeg, and GD installed as well.  If I remember, GD was already on Debian, or maybe it was in PHP, not sure about that, but I know it must installed.