Excute Multi PHP on Ubuntu

Excute Multi PHP on Ubuntu at the same time.

sudo apt-get install php5.6 php5.6-fpm php5.6-mysql libapache2-mod-php5.6 libapache2-mod-fcgid -y

sudo apt-get install php7.2 php7.2-fpm php7.2-mysql libapache2-mod-php7.2 -y

sudo systemctl start php5.6-fpm
sudo systemctl status php5.6-fpm

sudo a2enmod actions fcgid alias proxy_fcgi

sudo mkdir /var/www/php56.dev.com
sudo mkdir /var/www/php72.dev.com

sudo chown -R www-data:www-data /var/www/php56.dev.com
sudo chown -R www-data:www-data /var/www/php72.dev.com
sudo chmod -R 755 /var/www/php56.dev.com
sudo chmod -R 755 /var/www/php72.dev.com

sudo nano /etc/apache2/sites-available/php56.dev.com.conf
sudo nano /etc/apache2/sites-available/php72.dev.com.conf

<VirtualHost *:80>
     ServerAdmin [email protected]
     ServerName php56.dev.com
     DocumentRoot /var/www/php56.dev.com
     DirectoryIndex info.php

     <Directory /var/www/php56.dev.com>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

    <FilesMatch \.php$>
      # For Apache version 2.4.10 and above, use SetHandler to run PHP as a fastCGI process server
      SetHandler "proxy:unix:/run/php/php5.6-fpm.sock|fcgi://localhost"

     ErrorLog ${APACHE_LOG_DIR}/php56.dev.com_error.log
     CustomLog ${APACHE_LOG_DIR}/php56.dev.com_access.log combined

sudo apachectl configtest

sudo a2ensite php56.dev.com
sudo a2ensite php72.dev.com

sudo a2dissite 000-default.conf

Comment List

Leave a comment

Your email address will not be published. Required fields are marked *