This installation was tested on Ubuntu 15.01 but could be used for a debian production server.
SuPhp has not been maintained for a few years now, so it is no longer in the repositories of recent distributions, and it has become difficult to compile it on a 4.x kernel (which is my case, since my transition to Ubuntu 15.10).
Note: the package is still available on Ubuntu 14.01LTS.
1 – Installation of base packages.
sudo apt-get install build-essential fakeroot dh-make debconf execstack dh-modaliases xserver-xorg-dev automake autoconf libaprutil1 libaprutil1-dev libsvn-dev wx2.8-headers libwxgtk2.8-dev libxml2-dev libpcre3-dev libbz2-dev libcurl4-openssl-dev libjpeg-dev libpng12-dev libxpm-dev libfreetype6-dev libmysqlclient-dev libgd-dev libgmp-dev libsasl2-dev libmhash-dev unixodbc-dev freetds-dev libpspell-dev libsnmp-dev libtidy-dev libxslt1-dev libmcrypt-dev apache2 apache2-dev libxml2 libaprutil1-dev libxml2 libxml2-dev libssl-dev pkg-config curl libcurl4-openssl-dev enchant libenchant-dev libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libvpx-dev libfreetype6 libfreetype6-dev libgmp10 libgmp-dev libicu-dev mcrypt libmcrypt4 libmcrypt-dev libpspell-dev libedit2 libedit-dev libsnmp30 libsnmp-dev libxslt1.1 libxslt1-dev postgresql-server-dev-9.4 postgresql-server-dev-all
2- PHP Compilation
First, we create a symbolic link for a library that might be potentially missing during the compilation:
sudo ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h
We retrieve the PHP source code:
sudo wget -O php-5.6.16.tar.gz http://fr2.php.net/get/php-5.6.16.tar.gz/from/this/mirror && tar xzvf php-5.6.16.tar.gz && cd php-5.6.16
Then we compile:
sudo ./configure --prefix=/usr/local/php --with-apxs2=/usr/bin/apxs2 --with-config-file-path=/usr/local/php/conf --with-config-file-scan-dir=/usr/local/php/conf.d --enable-debug --with-openssl --with-kerberos --with-zlib --enable-calendar --with-curl --with-enchant --enable-exif --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-vpx-dir=/usr --with-freetype-dir=/usr --enable-exif --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-intl --enable-mbstring --with-mcrypt --with-mysql --with-mysqli --enable-pcntl --with-pdo-mysql --with-pdo-pgsql --with-pgsql --with-pspell --with-libedit --with-readline --enable-shmop --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvshm --with-xsl --enable-zip --with-pear --enable-zend-signals --enable-maintainer-zts --enable-bcmath && sudo make && sudo make install
3- Apache configuration:
We reference our directory where PHP is located, in the apache2 configuration file /etc/apache2/apache2.conf
sudo vi /etc/apache2/apache2.conf ScriptAlias /php5.6.16/ "/usr/local/php/bin/" <Directory "/usr/local/php/bin/"> AllowOverride All Options None Order allow,deny Allow from all </Directory>
We then proceed to configure our virtual host with the following directives:
Action php-script '/php5.6.16/php-cgi-5.6.16' AddHandler php-script .php PHPIniDir "/var/www/ATLV/"
This gives us a configuration as follows:
<VirtualHost *:80> Options FollowSymLinks DirectoryIndex app_dev.php ServerName www.kuoni.dev DocumentRoot /var/www/ATLV/web Action php-script '/php5.6.16/php-cgi-5.6.16' AddHandler php-script .php PHPIniDir "/var/www/ATLV/" <Directory /var/www/ATLV/web> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all DirectoryIndex app_dev.php </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
We just have to enable the actions mod:
a2enmod actions
And to restart apache2:
service apache2 restart
And voila: