mercredi 14 octobre 2009

Build php5.3 from source

sudo apt-get install libtidy-dev curl libcurl4-openssl-dev libcurl3 libcurl3-gnutls zlib1g zlib1g-dev libxslt1-dev libzip-dev libzip1 libxml2 libsnmp-base libsnmp15 libxml2-dev libsnmp-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev zlib1g zlib1g-dev libfreetype6 libfreetype6-dev libbz2-dev libmcrypt-dev libmcrypt4 apache2-prefork-dev apache2-dev

Get snapshots de php5.3.x from http://php.net

http://fr.php.net/get/php-5.3.0.tar.gz/from/this/mirror


...for example


tar -zxf php-5.3.0.tar.gz


cd php-5.3.0

make distclean



./configure --with-apxs2=/usr/bin/apxs2 -prefix=/opt/php --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config --with-tidy=/usr --with-curl=/usr/bin --with-curlwrappers --with-openssl-dir=/usr --with-zlib-dir=/usr --enable-mbstring --with-pdo-mysql=/usr --with-xsl=/usr --with-ldap --with-xmlrpc --with-iconv-dir=/usr --with-snmp=/usr --enable-exif --enable-calendar --with-bz2=/usr --with-mcrypt=/usr --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib-dir=/usr --with-freetype-dir=/usr --enable-mbstring --enable-zip --with-pear --with-config-file-path=/etc/php5 --with-config-file-scan-dir=/etc/php5/conf.d



make

sudo make install


then,

install your php extensions ( apc, mcrypt, pdo, ... )

If unavailable, try:


sudo pecl install pdo


If you have to change your php.ini path, you can use Apache conf Directive :


PHPIniDir /etc/php5/apache2


but with the 'with-config-file-path=/etc/php5' configure option, it will search for /etc/php5/php.ini, so you only have to make a symbolic link between /etc/php5/php.ini /etc/php5/apache2/php.ini