7
I have an Apache/2.4.10 (Ubuntu) server running a site in php 5.5. But I’m creating a new site and it needs php 5.6. It has to have two versions of php installed on my server and use each one in different folders?
7
I have an Apache/2.4.10 (Ubuntu) server running a site in php 5.5. But I’m creating a new site and it needs php 5.6. It has to have two versions of php installed on my server and use each one in different folders?
7
Example in Linux Mint 18
Asumindo that Apache is installed, created the virtual host for both projects and added the required php Ppas. Let’s assume the site56.local project in php5.6 and the site70.local project in php7.0.
Install php5.6-fpm and php7.0fpm with the following command:
sudo apt-get install php7.0-fpm
Create two files in /usr/lib/cgi-bin/ and save
sudo nano /usr/lib/cgi-bin/php56-fcgi
sudo nano /usr/lib/cgi-bin/php70-fcgi
Open php56 conf file "/etc/apache2/conf-available/php5.6-fpm.conf" add the following settings and save.
<IfModule mod_fastcgi.c> AddHandler php56-fcgi .php Action php56-fcgi /php56-fcgi Alias /php56-fcgi /usr/lib/cgi-bin/php56-fcgi -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization Action php70-fcgi /php70-fcgi Alias /php70-fcgi /usr/lib/cgi-bin/php70-fcgi -socket /var/run/php/php7.0-fpm.sock -pass-header Authorization </IfModule> <Directory /usr/lib/cgi-bin> Require all granted </Directory>
Now enable the new Apache configuration.
sudo a2enconf php5.6-fpm
If you installed php5.6 and php5.7, check to see if you disabled both and restarted Apache.
sudo a2dismod php5.6 php7.0
sudo systemctl restart apache2
Create a . htacces file in the project that should be in php7.0 and add the following Handler.
AddHandler php70-fcgi .php
Now create a phpinfo file in the project and see if it worked.
Note: Check that htaccess is enabled in your apache2.conf or httpd.conf.
Browser other questions tagged php linux apache ubuntu
You are not signed in. Login or sign up in order to post.
Interesting fact: is there a problem of using 5.6 in both? From 5.5 to 5.6 should not have changed so much. By the way, why still the version 5 and not the 7, which is the latest?
– Woss
Basically the server has other systems, such as a camera system and I have no contact with the developer. Changing the php version can make everything that is already on the server stop working!
– Lindolfo Moizinho
I agree that if the versions are very close there will be no difference, but if they are these very far away can interfere in the functioning.
– Renato Junior