Answer the question
In order to leave comments, you need to log in
How to run php 5.6 and php 7 at the same time?
How to implement for each virtual host its own version of php on Apache?
is it possible without docker and the like?
If not, then I came across apache-multiphp , but the docker is new and I don’t know how to implement it correctly ....
Suddenly it will come in handy for someone (I made a manual for myself):
sudo apt-get install apache2 apache2-utils
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install libapache2-mod-fastcgi libapache2-mod-fcgid
sudo apt-get install php5.6-fpm php5.6 php5.6-mcrypt php5.6-mbstring php5.6-mysql php5.6-zip php5.6-gd php5.6-xml
sudo apt-get install php7.0-fpm php7.0 php7.0-mcrypt php7.0-mbstring php7.0-mysql php7.0-zip php7.0-gd php7.0-xml
sudo a2enmod actions
sudo a2enmod fastcgi
sudo a2enmod fcgid
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include
sudo nano /etc/apache2/sites-available/php56.conf
<IfModule mod_fastcgi.c>
AddHandler php56-fcgi-www .php
Action php56-fcgi-www /php56-fcgi-www
Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -pass-header Authorization
<Directory "usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName php56
DocumentRoot /var/www/html/php56
<Directory "/var/www/html/php56">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
SetHandler php56-fcgi-www
</Directory>
</VirtualHost>
sudo nano /etc/apache2/sites-available/php70.conf
<IfModule mod_fastcgi.c>
AddHandler php70-fcgi-www .php
Action php70-fcgi-www /php70-fcgi-www
Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php/php7.0-fpm.sock -pass-header Authorization
<Directory "usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName php70
DocumentRoot /var/www/html/php70
<Directory "/var/www/html/php70">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
SetHandler php70-fcgi-www
</Directory>
</VirtualHost>
sudo mkdir -p /var/www/html/php56
sudo nano /var/www/html/php56/index.php
<?php phpinfo() ?>
sudo mkdir -p /var/www/html/php70
sudo nano /var/www/html/php70/index.php
<?php phpinfo() ?>
sudo a2dissite 000-default (вимкнути сайт за замовчуванням)
sudo a2ensite php56
sudo a2ensite php70
sudo service apache2 restart
Answer the question
In order to leave comments, you need to log in
docker, zhmoker, do not invent. install php as fpm.
apt-get install php5.6-fpm
apt-get install php7.1-fpm
I will add to the piggy bank another version of several php on gent
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question