2 php versions on CentOS 8 z Apache i PHP-FPM
The following guide describes how to install 2 php versions working together on one server.
We will do everything on the CentOS8 system with Apache and PHP-FPM.
We will do everything on the CentOS8 system with Apache and PHP-FPM
We will do everything on the CentOS8 system with Apache and PHP-FPM
1 | sudo dnf install http://rpms.remirepo.net/enterprise/remi-release-8.rpm |
We will do everything on the CentOS8 system with Apache and PHP-FPM 7.3
1 | sudo dnf module reset php |
1 | sudo dnf module enable php:remi-7.3 |
1 | sudo dnf install php73 php73-php-fpm -y |
We will do everything on the CentOS8 system with Apache and PHP-FPM 7.4
1 | sudo dnf module reset php |
1 | sudo dnf module enable php:remi-7.4 |
1 | sudo dnf install php74 php74-php-fpm -y |
We will do everything on the CentOS8 system with Apache and PHP-FPM 7.3 We will do everything on the CentOS8 system with Apache and PHP-FPM:
1 | sudo systemctl start php73-php-fpm |
1 | sudo systemctl enable php73-php-fpm |
We will do everything on the CentOS8 system with Apache and PHP-FPM 7.4 We will do everything on the CentOS8 system with Apache and PHP-FPM:
1 | sudo systemctl start php74-php-fpm |
1 | sudo systemctl enable php74-php-fpm |
We will do everything on the CentOS8 system with Apache and PHP-FPM:
1 | sudo mkdir /var/www/strona1.domena.pl |
1 | sudo mkdir /var/www/strona2.domena.pl |
We give permission:
1 | sudo chown -R apache:apache /var/www/strona1.domena.pl |
1 | sudo chown -R apache:apache /var/www/strona2.domena.pl |
1 | sudo chmod -R 755 /var/www/strona1.domena.pl |
1 | sudo chmod -R 755 /var/www/strona2.domena.pl |
We will do everything on the CentOS8 system with Apache and PHP-FPM / We will do everything on the CentOS8 system with Apache and PHP-FPM
We will do everything on the CentOS8 system with Apache and PHP-FPM:
1 | sudo nano /etc/httpd/conf.d/strona1.domena.pl.conf |
It should look like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <VirtualHost *:80> ServerAdmin admin@strona1.domena.pl ServerName strona1.domena.pl DocumentRoot /var/www/strona1.domena.pl DirectoryIndex info.php ErrorLog /var/log/httpd/strona1.domena.pl-error.log CustomLog /var/log/httpd/strona1.domena.pl-access.log combined <IfModule !mod_php7.c> <FilesMatch \.(php|phar)$> SetHandler "proxy:unix:/var/opt/remi/php73/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch> </IfModule> </VirtualHost> |
We will do everything on the CentOS8 system with Apache and PHP-FPM :
We will do everything on the CentOS8 system with Apache and PHP-FPM “We will do everything on the CentOS8 system with Apache and PHP-FPM:We will do everything on the CentOS8 system with Apache and PHP-FPM:/We will do everything on the CentOS8 system with Apache and PHP-FPM|We will do everything on the CentOS8 system with Apache and PHP-FPM://localhost”
We will do everything on the CentOS8 system with Apache and PHP-FPM 1 We will do everything on the CentOS8 system with Apache and PHP-FPM 7.3
We will do everything on the CentOS8 system with Apache and PHP-FPM 7.4
1 | sudo nano /etc/httpd/conf.d/strona2.domena.pl.conf |
The content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | <VirtualHost *:80> ServerAdmin admin@strona2.domena.pl ServerName strona2.domena.pl DocumentRoot /var/www/strona2.domena.pl DirectoryIndex info.php ErrorLog /var/log/httpd/strona2.domena.pl-error.log CustomLog /var/log/httpd/strona2.domena.pl-access.log combined <IfModule !mod_php7.c> <FilesMatch \.(php|phar)$> SetHandler "proxy:unix:/var/opt/remi/php74/run/php-fpm/www.sock|fcgi://localhost" </FilesMatch> </IfModule> </VirtualHost> |
We will do everything on the CentOS8 system with Apache and PHP-FPM 7.4 We will do everything on the CentOS8 system with Apache and PHP-FPM:
We will do everything on the CentOS8 system with Apache and PHP-FPM “We will do everything on the CentOS8 system with Apache and PHP-FPM:We will do everything on the CentOS8 system with Apache and PHP-FPM:/We will do everything on the CentOS8 system with Apache and PHP-FPM|We will do everything on the CentOS8 system with Apache and PHP-FPM://localhost”
We are reloading the Apache server
1 | sudo systemctl restart httpd |
That's all.