apt-get update
apt-get ugrade
apt-get install build-essential
This packages contain a lot of necessary tools like a c and a c++ compiler, make and other libs.
apt-get install git
apt-get install lamp-server^
The installation will ask you to choose a password for the mysql root user. Once finished, open a tab in your browser to http://localhost
You should see a page with the heading "It Works!"
cd /opt
git clone git://git.code.sf.net/p/phpfarm/code phpfarm
cd /opt/phpfarm/src
./compile 5.5.0
If the compilation fails, just install the libraries that caused the interruption. My first compilation complained about libxml2 and an openssl lib missing. It that's the case for you run
apt-get install libxml2 libxml2-dev libssl-dev
./compile 5.5.0
To verify the installation
cd /opt/phpfarm/src/inst/bin
./php-5.5.0 --version
apt-get install libapache2-mod-fastcgi apache2-mpm-worker apache2-suexec a2enmod actions fastcgi suexec
Edit the /etc/apache2/apache2.conf, add these lines before the includes
FastCgiServer /var/www/cgi-bin/php-cgi-5.5.0
ScriptAlias /cgi-bin-php/ /var/www/cgi-bin/
Now create the file /var/www/cgi-bin/php-cgi-5.5.0, with this content
#!/bin/sh
PHPRC="/etc/php5/cgi/5.5.0/"
export PHPRC
PHP_FCGI_CHILDREN=3
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /opt/phpfarm/inst/bin/php-cgi-5.5.0
Make the file executable
chmod +x /var/www/cgi-bin/php-cgi-5.5.0
Configure a VirtualHost to use the php version we just configured eg: /etc/apache2/sites-available/example.conf
<VirtualHost *:80>
ServerName example.dev
DocumentRoot /var/www/example/
<Directory "/var/www/example">
AddHandler php-cgi .php
Action php-cgi /cgi-bin-php/php-cgi-5.5.0
<FilesMatch "\.php$">
SetHandler php-cgi
</FilesMatch>
</Directory>
</VirtualHost>
Enable the site
a2ensite example.conf
Add the server to /etc/hosts
127.0.0.1 example.dev
Restart apache
service apache2 restart
If you don't get any error you will find a working installation of PHP5.5.0 at http://example.dev :)
Thanks for this tutorial. It really works. I just needed to enable the Apache2 actions module
P.S. Is there a way to keep 2 PHP versions enabled for separate folders? I can compile 2 versions and configure 2 different virtualhosts but how can I add 2 servers in /etc/apache2/apache2.conf?