Solved problem trying to configure PHP with GD support


I was just trying to install PHP from source code on a CentOS Linux box, specifically trying to configure PHP with GD support with a configure command like this:

./configure --with-apxs2=/usr/local/apache2/bin/apxs \
            --with-mysql \

Unfortunately this configure command fails, ending with the following two lines of error output:

If configure fails try --with-jpeg-dir=<DIR>
configure: error: libpng.(a|so) not found.


After digging around, I finally figured out that not only did I have to install libpng and libjpeg, as the installation document suggests, but I also had to install the "devel" versions of these two libraries to get configure to work, like this:

yum install libpng
yum install libpng-devel
yum install libjpeg
yum install libjpeg-devel

After installing all of these libraries, the PHP configure script ran properly, as did the make and make install commands.