Apache

Apache CPU usage and Memory usage is too high ([warn-phpd] mmap cache can’t open /var/www/../httpdocs too many open files

Apache can be a big memory user. Apache runs a number of ‘servers’ and shares incoming requests among them. The memory used by each server grows, especially when the web page being returned by that server includes PHP or Perl that needs to load in new libraries. It is common for each server process to use as much as 10% of a server’s memory.

If your server is operating in normal mode, but Apache cpu usage and memory usage is too high. You can find below error in /var/log/httpd/error_log file.

[warn-phpd] mmap cache can’t open /var/www/vhosts/example.com/httpdocs too many open files (pid 885428)

Cause:

It happens when Apache configured PHP_ADMIN_VALUE , open_basedir or safe_mode is set as “ON“. performance of PHP Engine and this behaviour can strongly affect server performance.

Resolution:

You can fixed above error editing below files.

1. Edit php.ini setting with parameter values like as the following:

# vim /etc/php.ini

realpath_cache_size=1024k
realpath_cache_ttl=7200
realpath_cache_size=40960k
realpath_cache_ttl=72000
memory_limit = 96M

2. Add the following line into the /etc/init.d/httpd startup script:

# /etc/init.d/httpd
...

start() {
#Raise the ulimit
ulimit -n 262144

That’s it.

Thanks.


Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment