How to change MPMs in cPanel Servers that run EasyApache 4?

This post explains how to change Multi-Processing Modules i.e. MPMs in cPanel systems that run EasyApache 4. Please note that if you run easyapache 3 web stack on your system this guide is not for you. With EasyApache 4, you can change MPMs from graphical interface as well as through command line however cPanel strongly recommends to use WHM graphical interface to change Apache MPMs.

What is Multi-Processing Modules (MPMs)?

Multi-Processing Modules i.e. MPMs are responsible for binding to network ports on the server, accepting http requests, and dispatching children to handle the http requests. This explains how choosing correct MPMs can improve the server performance.  Each MPM is different from other hence we need to implement one as per our web application requirement. We can use a threaded MPM like worker or event if we host websites that need scalability while websites that use older softwares and need stability and compatibility can use a prefork MPM.

Please note by default EasyApache 4 installs the prefork MPM. You can install one MPM on your server at a time.

Method 1 – How to change your Apache MPM in WHM?

Step 1.  On Home Page Click Softwares.

 

Step 2.  Then click on EasyApache 4.

 

Step 3.  If you want to choose event mpm, just shuffle the grey icon as shown in following image. It will choose the event mpm for the installation. After that just click on review and complete the installation.

 

Method 2 –  How to change MPM on the command line?

To change MPM on the command line, you should use the yum shell which is very basic shell. There are few steps you need to follow to replace mpm.

Step 1.   Enter in yum shell.
Step 2.   Remove existing MPM.
Step 3.   Install New MPM
Step 4.   Run

Please note that yum shell will stage step 2 and step 3 that means it will not install or remove mpm after you execute those commands, it will simply stage or prepare those actions. All commands will be executed only after you enter “run” command as shown in step 4.

Let’s do it. First we need to find out which MPM is currently installed on the server.  One of the easiest way to check it is to check /usr/lib64/apache2/modules directory for a module with ‘mpm’ in it’s name.

root@server [~]# cd /usr/lib64/apache2/modules
root@server [/usr/lib64/apache2/modules]# ls | grep mpm
mod_mpm_prefork.so*

Above result shows prefork mpm being installed on the server. Let’s remove it and install worker mpm.

Step 1.  Enter the yum shell

root@server [~]# yum shell
 Loaded plugins: fastestmirror, tsflags, universal-hooks
 Setting up Yum Shell
 >

Step 2.  Remove prefork MPM.

> remove ea-apache24-mod_mpm_prefork
Setting up Remove Process

Step 3. Install worker MPM.

> install ea-apache24-mod_mpm_worker
Loading mirror speeds from cached hostfile
 * EA4: 67.222.0.10
 * base: mirror.raystedman.net
 * extras: mirror.dallas-tx.riverfrontnetworks.com
 * updates: mirror.oss.ou.edu
EA4 | 2.9 kB 00:00 ...
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
vz-base | 951 B 00:00
vz-updates | 951 B 00:00
Setting up Install Process

Step 3.  Tell yum to finish previously entered commands.

> run
 --> Running transaction check
 ---> Package ea-apache24-mod_mpm_prefork.x86_64 0:2.4.25-7.7.1.cpanel will be erased
 --> Processing Dependency: ea-apache24-mpm = forked for package: ea-apache24-mod_cgi-2.4.25-7.7.1.cpanel.x86_64
 ---> Package ea-apache24-mod_mpm_worker.x86_64 0:2.4.25-7.7.1.cpanel will be installed
 --> Processing Dependency: ea-apache24-mod_cgid for package: ea-apache24-mod_mpm_worker-2.4.25-7.7.1.cpanel.x86_64
 --> Running transaction check
 ---> Package ea-apache24-mod_cgi.x86_64 0:2.4.25-7.7.1.cpanel will be erased
 ---> Package ea-apache24-mod_cgid.x86_64 0:2.4.25-7.7.1.cpanel will be installed
 --> Finished Dependency Resolution

=====================================================================================================================================================================================================
 Package Arch Version Repository Size
 =====================================================================================================================================================================================================
 Installing:
 ea-apache24-mod_mpm_worker x86_64 2.4.25-7.7.1.cpanel EA4 40 k
 Removing:
 ea-apache24-mod_mpm_prefork x86_64 2.4.25-7.7.1.cpanel @EA4 30 k
 Installing for dependencies:
 ea-apache24-mod_cgid x86_64 2.4.25-7.7.1.cpanel EA4 37 k
 Removing for dependencies:
 ea-apache24-mod_cgi x86_64 2.4.25-7.7.1.cpanel @EA4 26 k

Transaction Summary
 =====================================================================================================================================================================================================
 Install 2 Package(s)
 Remove 2 Package(s)

Total download size: 78 k
 Is this ok [y/N]: y
 Downloading Packages:
 (1/2): ea-apache24-mod_cgid-2.4.25-7.7.1.cpanel.x86_64.rpm | 37 kB 00:00 ...
 (2/2): ea-apache24-mod_mpm_worker-2.4.25-7.7.1.cpanel.x86_64.rpm | 40 kB 00:00 ...
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 Total 5.8 MB/s | 78 kB 00:00
 Running rpm_check_debug
 Running Transaction Test
 Transaction Test Succeeded
 Running Transaction
 Installing : ea-apache24-mod_cgid-2.4.25-7.7.1.cpanel.x86_64 1/4
 Installing : ea-apache24-mod_mpm_worker-2.4.25-7.7.1.cpanel.x86_64 2/4
 Erasing : ea-apache24-mod_cgi-2.4.25-7.7.1.cpanel.x86_64 3/4
 Erasing : ea-apache24-mod_mpm_prefork-2.4.25-7.7.1.cpanel.x86_64 4/4
 warn [009-phpconf] One or more key settings for “server.yogsays.com” were either not found in cPanel & WHM’s server configuration file (/var/cpanel/cpanel.config), or were present but did not pass validation.
 warn [009-phpconf] The following settings were absent and have been selected based on the current state of your installation.
 warn [009-phpconf] invite_sub = 0
 warn [009-phpconf] The following settings were absent or invalid. Your server has copied the defaults for them from the configuration defaults file (/usr/local/cpanel/etc/cpanel.config).
 warn [009-phpconf] query_apache_for_nobody_senders = 1
 warn [009-phpconf] empty_trash_days = disabled
 warn [009-phpconf] The following settings are obsolete and have been removed from the server configuration file:
 warn [009-phpconf] disableipnscheck, skipwhoisns
 warn [009-phpconf] Read the cpanel.config file documentation (https://go.cpanel.net/cpconfig) for important information about this file.
 Purging all relevant cached command results
 Removing: /root/.cpanel/datastore/_usr_sbin_httpd_-v
 Removing: /root/.cpanel/datastore/_usr_sbin_httpd_-l
 Removing: /root/.cpanel/datastore/_usr_sbin_httpd_-V
 Rebuilding global cache
 Building global cache for cpanel...Done
 info [modsec_cpanel_conf_init] The modsec2.cpanel.conf file and its datastore are already set up. No further action is required.
 info [rebuildhttpdconf] Missing owner for domain server.yogsays.com, force lookup to root
 info [rebuildhttpdconf] Missing owner for domain server.yogsays.com, force lookup to root
 Built /etc/apache2/conf/httpd.conf OK
 /usr/sbin/apachectl is already updated.
 Fix mailman RPM directories …
 … PID 11309
 Fix mailing list perms …
 … PID 11311
 Aligning modsec config to Whostmgr
 - Whostmgr version 11.60.0.39
 - Whostmgr supports conf.d/modsec location
 - No change necessary
 Waiting for “httpd” to stop ………finished.

Log Messages
 Apr 14 04:09:50 test yum[11015]: Erased: ea-apache24-mod_mpm_prefork
 Apr 14 04:09:50 test yum[11015]: Erased: ea-apache24-mod_cgi
 Apr 14 04:09:50 test yum[11015]: Installed: ea-apache24-mod_mpm_worker-2.4.25-7.7.1.cpanel.x86_64
 Apr 14 04:09:50 test yum[11015]: Installed: ea-apache24-mod_cgid-2.4.25-7.7.1.cpanel.x86_64
 [Fri Apr 14 04:02:58.749179 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 04:02:38.190855 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 04:01:31.792732 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:52:00.264166 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:51:11.272659 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:49:11.082570 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:47:12.407932 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:44:59.464977 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:37:13.803212 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:36:35.066938 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:35:38.829148 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Thu Apr 13 11:25:07.747906 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Thu Apr 13 11:25:05.677696 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Thu Apr 13 11:25:05.598015 2017] [:notice] [pid 2519] ModSecurity for Apache/2.9.0 (http://www.modsecurity.org/) configured.

httpd stopped successfully.
 Waiting for “httpd” to start ……waiting for “httpd” to initialize ………finished.

Log Messages
 Apr 14 04:09:50 test yum[11015]: Erased: ea-apache24-mod_mpm_prefork
 Apr 14 04:09:50 test yum[11015]: Erased: ea-apache24-mod_cgi
 Apr 14 04:09:50 test yum[11015]: Installed: ea-apache24-mod_mpm_worker-2.4.25-7.7.1.cpanel.x86_64
 Apr 14 04:09:50 test yum[11015]: Installed: ea-apache24-mod_cgid-2.4.25-7.7.1.cpanel.x86_64
 [Fri Apr 14 04:09:53.760511 2017] [mpm_worker:notice] [pid 11327:tid 140571829106656] AH00292: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 04:09:53.740297 2017] [:notice] [pid 11326:tid 140571829106656] ModSecurity for Apache/2.9.0 (http://www.modsecurity.org/) configured.
 [Fri Apr 14 04:02:58.749179 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 04:02:38.190855 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 04:01:31.792732 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:52:00.264166 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:51:11.272659 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:49:11.082570 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:47:12.407932 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:44:59.464977 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:37:13.803212 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:36:35.066938 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Fri Apr 14 03:35:38.829148 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Thu Apr 13 11:25:07.747906 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Thu Apr 13 11:25:05.677696 2017] [mpm_prefork:notice] [pid 2521] AH00163: Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 configured -- resuming normal operations
 [Thu Apr 13 11:25:05.598015 2017] [:notice] [pid 2519] ModSecurity for Apache/2.9.0 (http://www.modsecurity.org/) configured.

httpd started successfully.
 Setting /home permissions to 0711......Done
 Setting permissions for........Done
 !!!! /etc/yum/universal-hooks/posttrans/cp_clear_packman_cache is not executable
 Verifying : ea-apache24-mod_mpm_worker-2.4.25-7.7.1.cpanel.x86_64 1/4
 Verifying : ea-apache24-mod_cgid-2.4.25-7.7.1.cpanel.x86_64 2/4
 Verifying : ea-apache24-mod_mpm_prefork-2.4.25-7.7.1.cpanel.x86_64 3/4
 Verifying : ea-apache24-mod_cgi-2.4.25-7.7.1.cpanel.x86_64 4/4

Removed:
 ea-apache24-mod_mpm_prefork.x86_64 0:2.4.25-7.7.1.cpanel

Dependency Removed:
 ea-apache24-mod_cgi.x86_64 0:2.4.25-7.7.1.cpanel

Installed:
 ea-apache24-mod_mpm_worker.x86_64 0:2.4.25-7.7.1.cpanel

Dependency Installed:
 ea-apache24-mod_cgid.x86_64 0:2.4.25-7.7.1.cpanel

Finished Transaction

Step 5. Quit yum shell

 >quit 
Leaving Shell 
root@server [~]#

Now, check whether MPM is changed.

root@server [~]# cd /usr/lib64/apache2/modules
root@server [/usr/lib64/apache2/modules]# ls | grep mpm
mod_mpm_worker.so*
root@server [/usr/lib64/apache2/modules]#

Above result shows worker being new MPM.

Leave a Reply

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

CommentLuv badge