Last updated on May 5th, 2016 at 01:37 am

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)

Apache change from prefork to worker MPM

Starting from Apache version 2.4 we cannot change the setting inside /etc/sysconfig/httpd. As per Apache, With the current version HTTPD variable is now ignored. The MPM is a loadable module, and choice of MPM can be changed by editing the configuration file /etc/httpd/conf.modules.d/00-mpm.conf

So go to the conf.modules.d directory, take a backup of current 00-mpm.conf file and then
Just uncomment this line
LoadModule mpm_worker_module modules/

And comment the below line
#LoadModule mpm_prefork_module modules/

Save the file.

Now you have changed the module from prefork to worker. But will this make PHP load?

You might be seeing this error or something similar if you have already configured PHP with Prefork, When you try to restart Apache instance

localhost.localdomain httpd[61702]: Invalid command ‘php_value’, perhaps misspelled or defined by a module not included in the ser…guration
localhost.localdomain systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
localhost.localdomain kill[61703]: kill: cannot find process “”
localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1
localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server.

How to fix this?

Very simple, go to /etc/httpd/conf.d/ and rename php.conf file to something like php.conf_PREFORK. This should make apache start without any issues.

NOTE:- When you are using Apache Worker MPM, PHP can only run as a external CGI / FCGI process. There are lot of tutorials out there on how to run php as a CGI process hence I am not explaining that here.

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)

Leave a Reply

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