PHP installation error - unable to install php5 - configure: error: libjpeg.(a|so) not found

I ran into this error message today when trying to install PHP 5.2.x on a CentOS Linux server:

unable to install php5 - configure: error: libjpeg.(a|so) not found.

Actually, although I wrote "install" above, I was trying to run the PHP configure script when I got that PHP error message. (configure is the command you run before you run the make or make install commands.)

It turns out that this PHP error isn't too bad. The solution is to install the Linux libjpeg-devel package, which I did with the yum command, like this:

yum install libjpeg-devel

You may actually need the following four packages all installed:

install libpng-devel, libjpeg-devel (and libpng, libjpeg)

But, I don't know for sure, because libpng and libjpeg were already installed on my system, and I also installed libpng-devel at the same time I installed libjpeg-devel.

To install any of these packages, just issue a yum command, similar to the one shown above. Or, you should be able to install all four of them at one time, like this:

yum install libpng-devel libjpeg-devel libpng libjpeg