Downgrade php7 to php56 on arch linux

Verfasst von Stephan Schielke

Veröffentlicht am 18.06.2016

A customer of mine uses an old and depricated version of php. My system on the other hand is up to date and uses php7. Nearly all the code is deprecated and the project did not compile. So I had to install the outdated php5.6 somehow. This tutorial shows you how to install php5.6 on arch. 

Luckily we are not the only ones. There is an AUR package for php56.

yaourt -S php56
 

Check the installation.

Version

php -v
PHP 7.0.7 (cli) (built: May 25 2016 18:40:26) ( NTS )
php56 -v
PHP 5.6.22 (cli) (built: Jun 18 2016 16:15:15)
 

Modules

ls -al /usr/lib/httpd/modules/ | grep libphp
-rwxr-xr-x 1 root root  9922792 Jun 18 16:17 libphp56.so
-rwxr-xr-x 1 root root 10473016 May 25 18:41 libphp7.so


Edit the server conf:

nano /etc/httpd/conf/httpd.conf
#LoadModule php7_module modules/libphp7.so
LoadModule php5_module modules/libphp56.so
#Include conf/extra/php7_module.conf
Include conf/extra/php56_module.conf

 

Test the configuration.
Add a php info file on the local test server:

nano /srv/http/test.php

<?php phpinfo(); ?>

 

Restart / start the apache server:

systemctrl restart httpd.service
systemctrl status httpd.service

 

Check if the "correct" php version is running.
Open "localhost/test.php"

 

The next step would be to convince the customer to upgrade his php...