How to install php5.3 to php5.2 in parallel in Ubuntu 11.10

This instructions are specific to Debian Linux and derivatives like Ubuntu up to the version 11.10 of Ubuntu. For more recent versions of Ubuntu please refer to Install php5.3 to php5.2 in parallel

In the following you will find a brief description on how to compile and install php 5.3 from source. In order to install both versions in parallel you still will need to pin down your php to version 5.2 though: Downgrade PHP on Debian sqeeze.

see also:

Install additional packages

apt-get install bison re2c libmysqlclient-dev libbz2-dev bzip2 libxslt1.1 libxslt1-dev libxml2 libxml2-dev libjpeg62-dev libpng12-dev libxpm-dev

You may need more package if you are not having apache2, mysql, gcc and linux sources.

Check symlinks in /usr/lib (Ubunbtu only)

Check if the below symlinks exist in @/usr/lib@, if nor create them!:

ln -s x86_64-linux-gnu/libjpeg.a libjpeg.a
ln -s x86_64-linux-gnu/
ln -s x86_64-linux-gnu/libpng.a libpng.a
ln -s x86_64-linux-gnu/

Download and extract php source

  1. download

  2. extract

  3. cd into the extracted folder

Run the configure command

_This configuration is based on based on pkg-php/php.git/debian/rules":;a=blob_plain;f=debian/rules;hb=HEAD._ The php5.2 rules are found "here

Run the configure command below inside the extracted php source folder.

./configure \
        --prefix=/usr/share/php53 \
        --datadir=/usr/share/php53 \
        --bindir=/usr/bin/php53 \
        --with-config-file-path=/etc/php53/apache2 \
        --with-config-file-scan-dir=/etc/php53/apache2/conf.d \
        --sysconfdir=/etc/php53/apache2 \
        --with-layout=GNU \
        --enable-mbstring \
        --with-mysql=/usr \
        --with-pdo-mysql \
        --with-mhash \
        --with-curl \
        --enable-soap \
        --enable-zip \
        --with-gettext \
        --with-xsl=/usr \
        --with-libxml-dir=/usr \
        --with-gd \
        --with-jpeg-dir=/usr \
        --with-xpm-dir=/usr/X11R6 \
        --with-png-dir=/usr \

./configure is reporting errors:

  1. I you are getting an error like configure: error: xxxx not found. Please check your XXXX installation. Check if you have installed the xxx package and also the according development package.

  2. You can debug your the configuration by searching for the line of code in ./configure wich is producing the error message and add the following code snipped before the lines found:

set -x

Execute the configure command again an see the detailed output.

Build and install

# optional, dauert, findet aber Fehler:
make test
# bringt die Dateien an ihren Platz: 
sudo make install > php53-install.log

You can review php53-install.log.

Configure Apache

This was the tricky part!

Now please follow the instruction on:

Updated by Andreas Kohlbecker over 9 years ago ยท 6 revisions