User Tools

Site Tools


php:compiling_php_from_source

Compiling PHP from source

1. Download the php source code

Download the PHP source code from PHP project page

Example from the linux console:

wget http://ch2.php.net/get/php-5.2.3.tar.bz2

2. Extract the source and change directory

Extract the source code:

tar -zxvf <package-name>

Change to the extracted directory

cd <package-name>

3. Configure, Make, Make Install

Configure the source with the needed settings (example):

 ./configure --host=i686-redhat-linux-gnu --build=i686-redhat-linux-gnu --target=i386-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-force-cgi-redirect --disable-debug --enable-pic --disable-rpath --enable-inline-optimization --with-bz2 --with-db4=/usr --with-curl --with-exec-dir=/usr/bin --with-freetype-dir=/usr --with-png-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gettext --with-ncurses --with-gmp --with-iconv --with-jpeg-dir=/usr --with-openssl --with-png --with-pspell --with-regex=system --with-expat-dir=/usr --with-zlib --with-layout=GNU --enable-bcmath --enable-exif --enable-ftp --enable-magic-quotes --enable-safe-mode --enable-sockets --enable-sysvsem --enable-sysvshm --enable-discard-path --enable-track-vars --enable-trans-sid --enable-yp --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --with-imap=shared --with-imap-ssl --with-kerberos=/usr/kerberos --with-ldap=shared --with-mysql=shared,/usr/local/mysql --with-pgsql=shared --enable-memory-limit --enable-bcmath --enable-shmop --enable-calendar --enable-dbx --enable-dio --enable-mcal --enable-force-cgi-redirect --enable-pcntl --with-dom-xslt --with-dom=/usr --with-unixODBC=shared,/usr --with-xml --enable-wddx --with-pear=/usr/share/pear --with-apxs2 --with-xsl --with-mcrypt

Build the executable program from source:

make

Install the program on the system:

make install

Restart apache

In order to make apache taking advantage of the new php install you have to restart the apache server:

service httpd restart
/srv/wiki.niwos.com/data/pages/php/compiling_php_from_source.txt · Last modified: 2009/08/15 12:14 (external edit)