Can anyone here instruct me way to install and configure Multi PhP with one apache instance on CentOS 7, and the proper way to test it..
the following commands assume you already sudo su -
or you will have to add sudo to each of the commands:
yum install httpd -y
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum install php56 -y
yum install php72 -y
yum install php56-php-fpm -y
yum install php72-php-fpm -y
systemctl stop php56-php-fpm
systemctl stop php72-php-fpm
sed -i 's/:9000/:9056/' /etc/opt/remi/php56/php-fpm.d/www.conf
sed -i 's/:9000/:9072/' /etc/opt/remi/php72/php-fpm.d/www.conf
systemctl start php72-php-fpm
systemctl start php56-php-fpm
make script wrapper to call php56-cgi and php72-cgi
cat > /var/www/cgi-bin/php56.fcgi << EOF
#!/bin/bash
exec /bin/php56-cgi
EOF
cat > /var/www/cgi-bin/php72.fcgi << EOF
#!/bin/bash
exec /bin/php72-cgi
EOF
sudo chmod 755 /var/www/cgi-bin/php56.fcgi
sudo chmod 755 /var/www/cgi-bin/php72.fcgi
cat > /etc/httpd/conf.d/php.conf << EOF
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
AddHandler php56-fcgi .php
Action php56-fcgi /cgi-bin/php56.fcgi
Action php72-fcgi /cgi-bin/php72.fcgi
<Directory /var/www/html/php56>
DirectoryIndex index.php
AllowOverride all
Require all granted
</Directory>
<Directory /var/www/html/php72>
DirectoryIndex index.php
AllowOverride all
Require all granted
</Directory>
EOF
mkdir -p /var/www/html/php56
mkdir -p /var/www/html/php72
echo "<?php phpinfo(); ?>" > /var/www/html/php56/index.php
echo "<?php phpinfo(); ?>" > /var/www/html/php72/index.php
echo "AddHandler php72-fcgi .php" > /var/www/html/php72/.htaccess
(http://127.0.0.1/php56)
(http://127.0.0.1/php72)
sudo systemctl enable httpd
sudo systemctl enable php56-php-fpm
sudo systemctl enable php72-php-fpm