phpfarm is a useful set of scripts which makes the installation and usage of multiple PHP versions easy and convenient. Basically, the instructions below follow the installation guidelines from the official git repository: https://github.com/cweiske/phpfarm.
- Install necessary packages for build process.
sudo apt-get install build-essential libxml2 libxml2-dev libssl-dev
libcurl4-openssl-dev pkg-config libcurl4-gnutls-dev libjpeg-dev
libpng12-dev libmysqlclient-dev
- Clone phpfarm repository into local directory (another FHS-compliant install location would be
/opt
).
git clone git://git.code.sf.net/p/phpfarm/code phpfarm
cd phpfarm/src
- (Optional) Configure compile options.
sudo vim custom-options-5.3.29.sh
- Compile php and verify it.
sudo ./compile.sh 5.3.29
~/phpfarm/inst/bin/php-5.3.29 --version
- (Optional) Switching versions can be done with
switch-phpfarm
(see phpfarm repository for details).
$ switch-phpfarm
Switch the currently active PHP version of phpfarm
Available versions:
5.3.29
5.4.6
$ switch-phpfarm 5.4.6
Note: inst/current-bin
must be part of $PATH for this.