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

6 thoughts on “php5.6, php7 on ubuntu14 via phpbrew”

  1. Hi

    thanks for the manual. Excellent.
    I’m also using Virtualmin and I’m having issues with adding my custom versions to load in it.

    When I try to use switch or use I always get the same error.


    root@t1:~# phpbrew list
    * (system)
    php-7.0.0
    php-5.6.10

    root@t1:~# phpbrew switch php-5.6.10
    Invalid argument php-5.6.10

    can you advice?

  2. I know this website gives quality based content and additional material, is there any other
    site which presents such things in quality?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.