Add remi repo + epel +codeit repo.
yum install -y epel-release yum-utils http://rpms.remirepo.net/enterprise/remi-release-7.rpm cd /etc/yum.repos.d && wget https://repo.codeit.guru/codeit.el`rpm -q --qf "%{VERSION}" $(rpm -q --whatprovides redhat-release)`.repo
Enable remi repo PHP 7.2 branch
yum-config-manager --enable remi-php72
Install Apache + php + php-fpm
yum install httpd php php-fpm php-common php-cli php-pear php-pdo php-mysqlnd php-pgsql php-opcache php-gd php-mbstring php-mcrypt php-xml mod_ssl mod_http2
Enable both httpd and php-fpm to systemd auto-start routine.
systemctl enable php-fpm.service systemctl enable httpd.service
Edit /etc/httpd/conf/httpd.conf and add these lines at the bottom of the file.
<IfModule mpm_prefork_module> php_value session.save_handler "files" php_value session.save_path "/var/lib/php/session" </IfModule>
Edit /etc/httpd/conf.modules.d/00-mpm.conf file to turn on the mpm_event module.
Comment out this line,
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
and uncomment this line.
LoadModule mpm_event_module modules/mod_mpm_event.so
Final result of the said 00-mpm.conf file should look like below:-
# Select the MPM module which should be used by uncommenting exactly # one of the following LoadModule lines: # prefork MPM: Implements a non-threaded, pre-forking web server # See: http://httpd.apache.org/docs/2.4/mod/prefork.html #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so # worker MPM: Multi-Processing Module implementing a hybrid # multi-threaded multi-process web server # See: http://httpd.apache.org/docs/2.4/mod/worker.html # #LoadModule mpm_worker_module modules/mod_mpm_worker.so # event MPM: A variant of the worker MPM with the goal of consuming # threads only for connections with active processing # See: http://httpd.apache.org/docs/2.4/mod/event.html # LoadModule mpm_event_module modules/mod_mpm_event.so
For any virtual host you want to have PHP enabled, open its corresponding .conf file and add these lines:-
<IfModule mpm_event_module> ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/path/to/website/root/$1 </IfModule>
So, if you want to enable PHP on a virtual host that is located at /var/www/html folder, the .conf file should look roughly like below:-
<VirtualHost 123.123.123.123:80> DocumentRoot "/var/www/html" ServerName example.com ServerAlias www.example.com ErrorLog /dev/null CustomLog /dev/null combined <IfModule mpm_event_module> ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1 </IfModule> <Directory "/var/www/html"> Require all granted allow from all </Directory> </VirtualHost>
Start both php-fpm and httpd.
systemctl start php-fpm systemctl start httpd
Pingback: Server Bug Fix: Unable to enable mpm-event in httpd | centos 7 - TECHPRPR
Pingback: Quest 1 – Secure, Lightning Fast, CentOS 7.3 Virtualmin VPS, Apache2+MariaDB+Multiple PHP Versions+OpCache+NGINX+Varnish+Redis – 25,000 Concurrent Goal – Part 27 – Apache2 MPM_EVENT + MOD_PageSpeed + NGINX Install from Source + Mods | Technolo
Pingback: Quest 1 – Secure, Lightning Fast, CentOS 7.3 Virtualmin VPS, Apache2+MariaDB+Multiple PHP Versions+OpCache+NGINX+Varnish+Redis – 25,000 Concurrent Goal – Part 27 – Apache2 MPM_EVENT + NGINX Install from Source + Mods | Technology Seattle