Jan 13 2008

Howto Build and Install Php 5.2.x on a CentOS 4.5 System

Published by at 8:15 am under linux

Download php5.2.x source code

wget http://sg.php.net/get/php-5.2.5.tar.bz2/from/us2.php.net/mirror

Configure Php 5.2.x build options.

./configure –with-apxs2=/usr/sbin/apxs –with-mysql=/usr/lib/mysql –enable-track-vars –enable-sockets –with-config-file-path=/etc –enable-ftp –with-zlib –with-openssl –enable-force-cgi-redirect –enable-exif –with-gd –enable-memory-limit –disable-debug –disable-rpath –disable-static –with-pic –enable-calendar –enable-sysvsem –enable-sysvshm –enable-sysvmsg –enable-trans-sid –enable-bcmath –with-bz2 –enable-ctype –with-db4 –with-iconv –with-gettext –enable-mbstring –enable-shmop –enable-wddx –with-xmlrpc –enable-yp –with-zlib –without-pgsql –enable-dbx –without-mm –with-jpeg-dir=/usr –enable-gd-native-ttf –with-imap-ssl –enable-soap –with-xml

THE PROBLEMS i FACED and how i resolved it are show below

apxs is required to build Apache2 modules. My installation of apache did not have this tool. So i had to install httpd-devel package

If any of the packages are missing, configuer script will spit out an error. Install those packages and re-run configure script as above until it is successful.

For example, if libpng is not installed in your system, configure will abort. Then install libpng and re-run configure.

Download and install libpng package, if needed

download from http://libpng.org/pub/png/libpng.html

Unzip and untar the file in a temp directory

Then do a ./configure

Then make install ( with root permission )

You may also need to install libjpeg files. Download from


Then do the following



make install.

Please note, the header files of jpeglib must be in PHP5 compilation include path. For example, /usr/local/include for cent OS 4.5

Once “configure” completes successfully, then need to compile and install PHP5

make test ( To ensure that you compilation went right )
make install ( run this with root permission )

Comments Off on Howto Build and Install Php 5.2.x on a CentOS 4.5 System

Comments are closed at this time.