I installed apc on my ubuntu 10.4 vps today using the following lines.

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

While everything works fine. I encounter problems configuring APC. I try to increase the allocated memory size. To my understanding I could do this either by increasing the amount of segments apc.shm_segments or apc.shm_size.

If I configure apc.shm_segments and restart/graceful the server apc.php still shows only one segment. In the apache error log I can find the line:

PHP Warning:  PHP Startup: apc.shm_segments setting ignored in MMAP mode in Unknown on line 0

How, would I make APC use apc.shm_segments?

Nevertheless, I'd prefer to use increase apc.shm_size to the 128M I configured as

kernel.shmmax = 134217728

However, everytime I configure apc.shm_size in /etc/php5/conf.d/apc.ini and restart/gracful apache. Apache does start but hangs. It does not serve any websites and a apache2ctl stop is not regarded anymore.

Has anyone experienced the same and/or knows why I can't change the shm_size default value?

Many thanks!

link|improve this question
1  
can you post the relevant config you are adding to your apache php config files – anthonysomerset Jul 16 '11 at 20:39
all i do is setting apc.shm_size = xxM, it doesn't matter which value even the apc.shm_size = 30M which is I believe the default value Apache stops working normally. My /etc/php5/conf.d/apc.ini looks like ` extension=apc.so` ` ;apc.shm_segments = 3` ` ;apc.shm_size = 96M` As soon as I uncomment apc.shm_size and try to restart the apache it hangs. apc.shm_segments is ignored. thanks! – Novazembla Jul 17 '11 at 10:38
feedback

1 Answer

up vote 0 down vote accepted

try this config and see if it works:

extension=apc.so

apc.enabled=1                  
apc.stat=1

apc.shm_segments=1                  
apc.shm_size=256M                  
apc.ttl=7200                        
apc.user_ttl=7200                  
apc.num_files_hint=10000
apc.max_file_size=5M            
apc.mmap_file_mask=/dev/zero
apc.enable_cli=1 
link|improve this answer
Found the culprit, apc.shm_size wants to be configured without the M in the size apc.shm_size = 128 works like a charm. Some more info on the problem can be found here. Many thanks! – Novazembla Jul 18 '11 at 10:02
sounds like you got an old version of APC then – anthonysomerset Jul 18 '11 at 12:53
feedback

Your Answer

 
or
required, but never shown

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