I am kind of new to mpm and all so please don't mind. I have a web server running 8 websites (php based) on it. And my RAM usage goes over 90 % and the swap usage goes over 80 %. And when i check

service httpd status

the number of request generally bounces to 30k and i see a lot of httpd processes. i tried to fix it via searching google and trying out this solution thinking that enabling php-fpm and mod_mpm_event will take all the loads off my RAM and SWAP, but it didn't work and the sites loaded like this where as the original site looked like this. So, i reverted to my old configurations.

my configurations:


[root@csmsvr-lin-lv-02 conf.modules.d]# cat 00-mpm.conf
# 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
<IfModule mpm_prefork_module>
    ServerLimit                  800
    StartServers                  5
    MinSpareServers          75
    MaxSpareServers         800
    MaxRequestWorkers    800
    MaxRequestsPerChild  0
# 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


[root@csmsvr-lin-lv-02 conf.modules.d]# cat /etc/httpd/conf.d/php.conf
# Cause the PHP interpreter to handle files with a .php extension.
<FilesMatch \.php$>
    SetHandler application/x-httpd-php

# Allow php to handle Multiviews
AddType text/html .php

# Add index.php to the list of files that will be served as directory
# indexes.
DirectoryIndex index.php

# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#<FilesMatch \.phps$>
#    SetHandler application/x-httpd-php-source

# 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"


 [root@csmsvr-lin-lv-02 conf.modules.d]# cat 00-base.conf
# This file loads most of the modules included with the Apache HTTP
# Server itself.

LoadModule access_compat_module modules/mod_access_compat.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule auth_digest_module modules/mod_auth_digest.so
LoadModule authn_anon_module modules/mod_authn_anon.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_dbd_module modules/mod_authn_dbd.so
LoadModule authn_dbm_module modules/mod_authn_dbm.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_socache_module modules/mod_authn_socache.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_dbd_module modules/mod_authz_dbd.so
LoadModule authz_dbm_module modules/mod_authz_dbm.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_owner_module modules/mod_authz_owner.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cache_module modules/mod_cache.so
LoadModule cache_disk_module modules/mod_cache_disk.so
LoadModule data_module modules/mod_data.so
LoadModule dbd_module modules/mod_dbd.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule dir_module modules/mod_dir.so
LoadModule dumpio_module modules/mod_dumpio.so
LoadModule echo_module modules/mod_echo.so
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule filter_module modules/mod_filter.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
LoadModule info_module modules/mod_info.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule remoteip_module modules/mod_remoteip.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
LoadModule socache_memcache_module modules/mod_socache_memcache.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule status_module modules/mod_status.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule suexec_module modules/mod_suexec.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule version_module modules/mod_version.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so

#LoadModule buffer_module modules/mod_buffer.so
#LoadModule watchdog_module modules/mod_watchdog.so
#LoadModule heartbeat_module modules/mod_heartbeat.so
#LoadModule heartmonitor_module modules/mod_heartmonitor.so
#LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule dialup_module modules/mod_dialup.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
#LoadModule log_debug_module modules/mod_log_debug.so
#LoadModule ratelimit_module modules/mod_ratelimit.so
#LoadModule reflector_module modules/mod_reflector.so
#LoadModule request_module modules/mod_request.so
#LoadModule sed_module modules/mod_sed.so
#LoadModule speling_module modules/mod_speling.so

httpd -l

[root@csmsvr-lin-lv-02 conf.modules.d]# httpd -l
Compiled in modules:

SYS config: RAM- 6 GB SWAP- 6 GB CPU- 8 Core php -v: 5.4.16 httpd -v : 2.4.6


The image you provide show that you didn't have a PHP handler set up (correctly). You should be able to use (in 00-base.conf):

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so

Then make sure the following is not commented:

LoadModule mpm_event_module modules/mod_mpm_event.so

Finally you need to change:

<FilesMatch \.php$>
    SetHandler application/x-httpd-php


ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://$1
DirectoryIndex /index.php index.php

Make sure you use the correct /path/to/your/documentroot. Also, php-fpm needs to be running (and listening on port 9000) for this to work. If it doesn't work, look in de logs of both Apache and PHP-FPM. Usually these are located in /var/log/httpd and /var/log/php-fpm.

| improve this answer | |
  • i changed the php.conf in /etc/conf.d/php.conf and commented out the set handler part and added the proxy pass match, still it didn't work. I next added the proxy pass to each virtual host and only one site was accessible but the images ddn't load. – swogat Dec 23 '18 at 9:59
  • i am getting an error php_value misspelled when i enable the mpm_event module. Searching a lot i think i came to a conclusion that, 'mpm-event and workers cannot be used in my case where the scripts need php_value' and there is only chance of using it if i upgrade php to 7. am i right ? – swogat Dec 23 '18 at 11:16
  • No, it is still possible to set this, but you need to do it in a different place. Have a look at secure.php.net/manual/en/install.fpm.configuration.php . This shows you can set php_flag[display_errors] = off in the PHP-FPM pool configuration. – tjikkun Dec 24 '18 at 9:01
  • my websites have php_value and php_flag variables defined in the .htaccess files. enabling mom_event shows error that php_value is misspelled. I looked at your answer and i just want to confirm, you are saying that if i define the php_value and php_flag in the file /etc/php-fpm.d/www.conf then this issue can be tackled ? – swogat Dec 26 '18 at 10:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.