Compiling PHP 5.2.9 on Ubuntu

tar -xjf php-5.2.9.tar.bz2

cd php-5.2.9

apt-get install php5-dev libmysqlclient15-dev bzip2 libcurl3 curl libpng12-dev libfreetype6-dev libmcrypt4 libmcrypt-dev libmhash2 libmhash-dev libxml2-dev libxslt1-dev apache2-prefork-dev libjpeg62-dev freetype2 libxft libxft-dev libcurl4-gnutls-dev libmcrypt4

./configure --with-apxs2=/usr/bin/apxs2 --with-config-file-path=/etc/php5/apache2/ --with-mysql --enable-inline-optimization --disable-debug --enable-bcmath --enable-calendar --enable-ctype --enable-dbase --enable-discard-path --enable-exif --enable-force-cgi-redirect --enable-ftp --enable-gd-native-ttf --with-ttf --enable-shmop --enable-sigchild --enable-sysvsem --enable-sysvshm --enable-wddx --with-zlib=yes --with-openssl --with-xsl  --with-gd --with-gettext --with-mcrypt --with-mhash --enable-sockets --enable-mbstring=all --enable-mbregex --enable-zend-multibyte --enable-exif --enable-soap --enable-pcntl --with-mysqli --with-mime-magic --with-iconv --with-pdo-mysql --with-freetype-dir=/usr/include/freetype2/freetype

make

make install

The above worked on Intrepid, below is an example that worked on Dapper. Here I have compiled as static libraries and put them in the /usr/local/lib dir:

tar -xjf php-5.2.9.tar.bz2

cd php-5.2.9

apt-get install make php5-dev libmysqlclient15-dev bzip2 libcurl3 curl libpng12-dev libfreetype6-dev libmhash2 libmhash-dev libxml2-dev libxslt1-dev apache2-prefork-dev libjpeg62-dev freetype2 libxft libxft-dev libcurl3-gnutls-dev libjpeg* libpng* libmcrypt*

./configure --with-apxs2=/usr/bin/apxs2 --with-config-file-path=/etc/php5/apache2 --with-mysql --enable-inline-optimization --disable-debug --enable-bcmath --enable-calendar --enable-ctype --enable-dbase --enable-discard-path --enable-exif --enable-force-cgi-redirect --enable-ftp --enable-gd-native-ttf --with-ttf --enable-shmop --enable-sigchild --enable-sysvsem --enable-sysvshm --enable-wddx --with-zlib=yes --with-openssl --with-xsl --with-gd --with-freetype-dir=/usr/local/lib --with-jpeg-dir --with-png-dir --with-gettext --with-mhash --enable-sockets --enable-mbstring=all --enable-mbregex --enable-zend-multibyte --enable-exif --enable-soap --enable-pcntl --with-mysqli --with-mime-magic --with-iconv --with-pdo-mysql --with-curl

make

apt-get --purge remove php5

make install

Note the use of that apt-get remove statement, before I ran it the gd library would not work for some strange reason, even though it worked with the prior version of php. Very strange and probably due to some kind of configuration problem that was resolved once I removed the default php installation completely.

Update: I just had problems with GD2 in Dapper, I got: Fatal error: Call to undefined function imagecreatefromjpeg(). That has now been taken care of by including all possible jpeg libraries in the apt-get line, ie libjpeg*, I’ve also got –with-jpeg-dir, notice the lack of an explicit directory there. The above lines have been changed to reflect this.


Related Posts

Tags: , ,