php5.6, php7 on ubuntu14 via phpbrew

Installation procedure for php5.6 (officel release) and php7 (alpha) on Ubuntu 14.04, via
phpbrew package.

Install requirements for phpbrew:
apt-get update
apt-get upgrade
apt-get build-dep php5
apt-get install php5 php5-dev php-pear autoconf automake curl build-essential libxslt1-dev re2c libxml2 libxml2-dev php5-cli bison libbz2-dev libreadline-dev
apt-get install libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libjpeg-dev libjpeg8-dev libjpeg8 libgd-dev libgd3 libxpm4 libltdl7 libltdl-dev

[optional / in some cases already exists]
apt-get install libssl-dev openssl
apt-get install gettext libgettextpo-dev libgettextpo0
apt-get install php5-cli
apt-get install libmcrypt-dev
apt-get install libreadline-dev

Install phpbrew
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew
chmod +x phpbrew
sudo mv phpbrew /usr/bin/phpbrew

Initialise phpbrew, update
phpbrew init
phpbrew known --update
phpbrew update
phpbrew self-update

List supported versions, install php 5.6
phpbrew known
phpbrew install 5.6.10 +default

Switch the default PHP version to 5.6.10
phpbrew switch 5.6.10

Install php-7, currently Alpha
phpbrew install next as php-7.0.0
phpbrew use php-7.0.0

 

I often use Virtualmin, so after PHP is compiled, let’s tell Virtualmin that it’s available to use.

Virtualmin looks for additional PHPs in a specific place so we have to do some symlinking to ensure it finds our PHPBrew installed PHP.
sudo mkdir /opt/rh/
sudo ln -s /root/.phpbrew/php/php-5.6.10/ /opt/rh/php56

Re-Check Configuration, and you get something like: The following PHP versions are available : 5.5.9 (/usr/bin/php5-cgi), 5.6.10 (/opt/rh/php56/bin/php-cgi)

Sources:
http://askubuntu.com/questions/550191/install-php-5-4-on-ubuntu-14-04-lts-without-compiling
https://devkardia.com/easyblog/ubuntu-12-04-multiple-php-versions-and-virtualmin-using-phpbrew.html
https://github.com/phpbrew/phpbrew/issues/462

你可能感兴趣的:(PHP)