20

I'm running CentOS 64 bit, and just found out I am running prefork MPM on my dual quad Xeon. I was told worker will give me lower memory usage and higher performance, since I run a very high traffic website.

If this is true, how do I do it?

Anthony Geoghegan
  • 2,875
  • 1
  • 24
  • 34
Andrew Fashion
  • 1,655
  • 7
  • 22
  • 26

4 Answers4

27

Edit: /etc/sysconfig/httpd

Uncomment:

HTTPD=/usr/sbin/httpd.worker

Restart, voila!

Rafiq Maniar
  • 1,120
  • 9
  • 15
  • Hi @RafiqManiar, by restart do you mean Apache or the whole server here? – ericn Feb 25 '13 at 05:04
  • 4
    Restart apache. sudo service httpd restart – Rafiq Maniar Feb 25 '13 at 08:31
  • 2
    CentOS 7. i am getting this: /usr/sbin/apachectl: line 137: /usr/sbin/httpd.worker: No such file or directory – YumYumYum Jun 12 '15 at 08:26
  • With apache 2.4, you will find this note in the httpd.worker file. With previous versions of httpd, the MPM could be changed by editing an "HTTPD" variable here. With the current 2.4 version, that variable is now ignored. The MPM is a loadable module, and the choice of MPM can be changed by editing the configuration file /etc/httpd/conf.modules.d/00-mpm.conf. – Ganesh S Jun 14 '23 at 11:08
9

CentOS 6x:

modify file: /etc/sysconfig/httpd

HTTPD=/usr/sbin/httpd.worker

CentOS 7x:

$ cat /etc/httpd/conf.modules.d/00-mpm.conf

    #LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
    LoadModule mpm_worker_module modules/mod_mpm_worker.so
    #LoadModule mpm_event_module modules/mod_mpm_event.so

Restart

YumYumYum
  • 265
  • 3
  • 11
  • 1
    From the file /etc/sysconfig/httpd for apache 2.4 # Note: With previous versions of httpd, the MPM could be changed by # editing an "HTTPD" variable here. With the current version, that # variable is now ignored. The MPM is a loadable module, and the # choice of MPM can be changed by editing the configuration file # /etc/httpd/conf.modules.d/00-mpm.conf. – Val Kornea Oct 21 '17 at 23:54
4

Edited: /etc/sysconfig/httpd

And uncommented:

HTTPD=/usr/sbin/httpd.worker

After restarting httpd (service httpd restart) I get the following error:

Stopping httpd:                                            [  OK  ]
Starting httpd: httpd.worker: Syntax error on line 222 of /etc/httpd/conf/httpd.conf: Syntax error on line 9 of /etc/httpd/conf.d/php.conf: Cannot load /etc/httpd/modules/libphp5-zts.so into server: /etc/httpd/modules/libphp5-zts.so: cannot open shared object file: No such file or directory
                                                           [FAILED]

You might need to install php-zts though.

yum install php-zts

After that no more error messages and httpd is starting normally with module worker active.

Michael Hampton
  • 244,070
  • 43
  • 506
  • 972
Wim
  • 41
  • 1
-2

-- Redhat Enterprise Linux 6

php-zts in RHEL is found in the "optional" repository:

# subscription-manager repos --enable rhel-6-server-optional-rpms
Repository 'rhel-6-server-optional-rpms' is enabled for this system.
# yum install php-zts
RyanM
  • 41
  • 5