Php – How to enable JPEG Support for PHP

gdlampPHP

My Configure Command doesn't say anything about jpg, nor gif/png, but I can see gif/png support in the output of phpinfo().

I built PHP with --with-gd, but only GIF Support and PNG Support are in the output of phpinfo(), how do I enable JPEG Support?

UPDATE

I got this problem when compiling :

Sorry, I cannot run apxs.  Possible reasons follow:

1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)

The output of /usr/local/apache2/bin/apxs follows:
cannot open /usr/local/apache2/build/config_vars.mk: No such file or directory at /usr/local/apache2/bin/apxs line 218.

What should I do now?

Best Answer

First cd to the directory of the PHP source. Then

make clean

Then compile with JPEG support (add this to all the other compile options you already had used):

--with-jpeg-dir=<put path to jpeg library here>

For example, if your jpeg library is located at:

/usr/lib/libjpeg.so

Use:

--with-jpeg-dir=/usr/lib