Apache MPM (Multi-Processing Modules) are Apache modules for creating child processes in Apache. There are many Apache MPM available, Each of them works in his own way. If you are using default Apache installation, Apache will use Prefork MPM by default.
Event MPM is launched with many improvements from worker MP. I prefer to use the Event MPM which is an improvement over the Worker MPM. Event MPM is that Event has a dedicated thread which handles all Keep Alive connections and requests.
This article will help you to Disable Prefork MPM and Enable Event MPM on Apache 2.4 running on your Linux operating system.
Enable Event MPM in Apache
First edit Apache MPM configuration file in your favorite text editor.
# vim /etc/httpd/conf.modules.d/00-mpm.conf
Comment LoadModule line for mpm_prefork_module, mpm_worker_module and Un comment LoadModule line for mpm_event_module in configuration as per showing below.
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so #LoadModule mpm_worker_module modules/mod_mpm_worker.soLoadModule mpm_event_module modules/mod_mpm_event.so
After making above changes just restart your Apache servers.
# systemctl restart httpd
Check Active MPM in Apache
Now you have successfully enabled Event MPM in your Apache server. To verify current MPM enabled on your server use following command.
[[email protected] ~]# httpd -V | grep MPM ServerMPM : event
4 Comments
I will thinking to change module prefork to module event/worker. but if any reflect to current project?
How to Check default parameters of prefork worker and event mpm and how to change these.
Hi If I do this Apache fails and will not start till I change it back? (CentOS7)
[[email protected] ~]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2016-01-13 11:10:50 EST; 3min 19s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 151 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Process: 122 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 122 (code=exited, status=1/FAILURE)
Jan 13 11:09:44 pnl-server1.petenetlive.com systemd[1]: httpd.service failed.
Jan 13 11:10:50 pnl-server1.petenetlive.com systemd[1]: Starting The Apache HTTP Server…
Jan 13 11:10:50 pnl-server1.petenetlive.com httpd[122]: AH00526: Syntax error on line 31 of /etc/httpd/conf.d/php.conf:
Jan 13 11:10:50 pnl-server1.petenetlive.com httpd[122]: Invalid command ‘php_value’, perhaps misspelled or defined by a module not included in the server configuration
Jan 13 11:10:50 pnl-server1.petenetlive.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 13 11:10:50 pnl-server1.petenetlive.com kill[151]: kill: cannot find process “”
Jan 13 11:10:50 pnl-server1.petenetlive.com systemd[1]: httpd.service: control process exited, code=exited status=1
Jan 13 11:10:51 pnl-server1.petenetlive.com systemd[1]: Failed to start The Apache HTTP Server.
Jan 13 11:10:51 pnl-server1.petenetlive.com systemd[1]: Unit httpd.service entered failed state.
Jan 13 11:10:51 pnl-server1.petenetlive.com systemd[1]: httpd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[[email protected] ~]# nano /etc/httpd/conf.d/php.conf
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# nano /etc/httpd/conf.modules.d/00-mpm.conf
[[email protected] ~]# service httpd start
Redirecting to /bin/systemctl start httpd.service
[[email protected] ~]# service httpd status
Redirecting to /bin/systemctl status httpd.service
● httpd.service – The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2016-01-13 11:16:22 EST; 5s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 151 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
Main PID: 710 (httpd)
Status: “Processing requests…”
CGroup: /system.slice/httpd.service
├─710 /usr/sbin/httpd -DFOREGROUND
└─712 /usr/sbin/httpd -DFOREGROUND
I had the same, but when checking the apache config for syntax errors, I got this
# apachectl configtest
AH00526: Syntax error on line 34 of /etc/httpd/conf.d/php.conf:
Invalid command ‘php_value’, perhaps misspelled or defined by a module not included in the server configuration
and the httpd server started up fine, after I’d commented out the 3 lines with that problem config variable
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
#php_value session.save_handler “files”
#php_value session.save_path “/var/lib/php/session”
#php_value soap.wsdl_cache_dir “/var/lib/php/wsdlcache”