PHP multiple installation

In this guide we will explain how to have more versions of PHP installed and ready to use in Condres OS.

First of all we install both php 7, 7.1, 7.2 and php 5.6 that are inside the repository

 pacman -S php php-apache php56 php56-apache php72 php72-apache php71 php71-apache

Check the installation.

Version:

php -v
PHP 7.3.0 (cli) (built: Dec  8 2018 12:11:20) ( NTS )
php56 -v
PHP 5.6.39 (cli) (built: Dec  9 2018 12:57:10) 

Modules

ls -al /usr/lib/httpd/modules/ | grep libphp
-rwxr-xr-x 1 root root  9978992  9 dic 13.57 libphp56.so 
-rwxr-xr-x 1 root root 13162272  8 dic 13.11 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/phptest.php

 

<?php phpinfo(); ?>

Restart / start the apache server:

systemctl restart httpd.service
systemctl status httpd.service

Check if the “correct” php version is running.
Open “localhost/phptest.php”

Calogero Scarnà
Calogero Scarnà
Articoli: 299

Newsletter

Inserisci il tuo nome e il tuo indirizzo email qui sotto e iscriviti alla nostra newsletter