How to Compile PHP 5.x From Scratch

I was asked to compile php5.4.14 on one of my server with mysql support.

I downloaded php 5.4.14 from mysql website and compiled it.

Later on mcrypt, ftp, openssl support were added to it.

I was also told to add dbase support. with –enable-dbase option php was not compiling. So to make dbase work I did

Get the source for dbase extension

As I told you, also DBase extension is no longer included, so:

1) cd /opt/php/php5-5.3.2/ext/

2) mkdir dbase

3) svn co http://svn.php.net/repository/pecl/dbase/trunk dbase

Compile the Extension

4) cd /opt/php/php5-5.3.2/ext/dbase

5) phpize

6) ./configure

7) make

Copy the extension

8) cp  /opt/php/php5-5.3.2/ext/dbase/modules/dbase.so /usr/lib/php5/20090626+lfs/.

make clean

./configure –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –with-apxs2 –with-libdir=lib64 –with-mysql –with-mysqli –with-zlib –with-pdo-mysql –with-mysql-sock=/var/mysql/mysql.sock –with-pdo-sqlite –with-mcrypt=/usr/bin/mcrypt –enable-ftp –enable-zip –with-openssl –with-openssl-dir=/usr/bin

 

make
make test
make install

 

Restart Apache

/etc/init.d/apache2 restart