I have two projects on the local server, one project is running PHP5.6 and the other one is running PHP7.0. Now would it be possible to enable this two versions based on the projects? I already tried adding AddHandler application/x-httpd-php7 .php
in one of the project htaccess but its not working. Currently, PHP7.0 and PHP5.6-fpm already installed on the server. Below is the screenshot of the phpinfo.
So after searching on Google for the whole day. I managed to run my two projects in FastCgi on different php versions. Thanks to the guys from this forum. I uninstalled everything including Apache and start over again. Below are the steps I used to enable two versions of PHP on my local server. Btw, my computer is running on Linux Mint 18.
Assuming you already installed Apache, created virtual host for the two projects and added the necessary php PPAs. Let's call the projects
site56.local
for PHP 5.6 andsite70.local
for PHP 7.0. Installphp5.6-fpm
andphp7.0-fpm
by running:Create two files under
/usr/lib/cgi-bin/
(honestly I don't know if this step is still necessary), and save:Open php56 conf file
/etc/apache2/conf-available/php5.6-fpm.conf
, add this config and save:Now enable the new apache config:
If you installed php5.6 and php5.7, make sure you disable this two and restart apache:
Create a
.htacces
file on the project that should run on php7.0 and add this handler:Now create a phpinfo file on the two projects and if you see something like this, then congratulations!
PS: Make sure you enable htaccess in your apache2.conf or httpd.conf
site56.local/phpinfo.php:
site70.local/phpinfo.php: