I have just installed APC to cache my PHP code on my small Ubuntu VPS server. Using

sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart

This labored fine. However, I encounter some problems growing the slice of RAM allotted to APC. Basically run apc.php it provides me with these details concerning the shared memory.

Shared Memory   1 Segment(s) with 30.0 MBytes (mmap memory, pthread mutex locking) 

Despite the fact that I set up

apc.shm_segments    3

Not setting the default

apc.shm_size    30

Additionally I have got the issue that the moment I set apc.shm_size in apc.ini or php.ini apache dangles on restart/elegant and wont show up.

My questions: 1. When the memory allotted to APC is apc.shm_size * apc.shm_segments why can one only see 90M? 2. Has anybody had the issue using the hanging Apache on setting of apc.shm_size? Wouldso would I fix that?

Thank you!

Appears like i discovered the issue

sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart

Installed a classic version of APC on my small machine. For the reason that version apc.shm_size=30M needs to be configuered with no M within the memory size. Thus new versions of APC use apc.shm_size=30M old version apc.shm_size=30. After I made the modification Apache restarted with no glitch.

You can examine the kernel max size for shared memory. On debian-like distribution the correct answer is low (and ubuntu is really a debian-like). Changing it via sysctl.conf can help you.? Get current value with:

sysctl -a  | grep shmmax

It is a value in Bytes.

This might explain apache crash whenever you set a too large number (but you ought to have something about this by mistake.record).

Appear for this response that apc.shm_segments isn't necessarily utilized by APC. We are able to see some explanations here: http://www.php.net/manual/fr/apc.configuration.php#94529:

If you have set up APC to make use of memory planned files (using the --enable-mmap option), the shm_segments setting is overlooked unless of course you specify personal files mask through the mmap_file_mask setting. That could be fixed by providing something to apc.mmap_file_mask configuration setting (see link).

But as stated within this comment, using several shared segments is unquestionably worst as utilizing a large one. there's a minimum of two large application making heavy utilization of large shared memory and which always needs a change from the kernel configurations for your, it's Varnish and PostgreSQL. Both made the option of utilizing a large shared segment rather than several.