Enabling APC Results in 500 Internal Server Error

Events happening in the community are now at Drupal community events on www.drupal.org.
Lloyd's picture

I've installed/enabled APC on a server running CENTOS 5.5 and configured via CPanel. As soon as it's enabled, I cannot access any Drupal page. I just get an Internal Server Error message (500). Any ideas on how to troubleshoot this or what could be going wrong? Below is my configuration.

apc.enable_cli = 1
apc.enable = 1
apc.num_files_hint = 1024
apc.optimization = 0
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200

Comments

you can check the apache logs

gerold's picture

you can check the apache logs of that account/website for 500 internal error (usually in /etc/httpd/domlogs/domain.com). how did you install apc - is it via module installers (whm -> module installers -> php pecl) ? Also, APC conflicts with ZendOptimizer if you have it installed.

I found something similiar on

renders's picture

I found something similiar on a recent LAMP install.. I had changed the shm_size to 48 from 30 and got an out of space error in the log.. I reset the size to 30 and it works fine..

Rob

my apc.ini setting below work

spacereactor's picture

my apc.ini setting below work for me under ubuntu 10.04, i think i read somewhere apc.shm_size = 128M must have "M"

apc.shm_size = 128M
apc.shm_segments=1
apc.write_lock = 1
apc.rfc1867 = On
apc.ttl=7200
apc.user_ttl=7200
apc.num_files_hint=1024
apc.mmap_file_mask=/tmp/apc.XXXXXX
apc.enable_cli=1

APC config

manarth's picture

i think i read somewhere apc.shm_size = 128M must have "M"

Yes - this changed many APC releases ago - it originally used a number, now it uses a number followed by "M".

The SHM entry is the size of the shared memory. In general, you want to assign enough shared memory that you can maintain as close to 100% hit rate in APC as possible. Too low a limit will often result in worse performance, because nothing will be cached (new entries simply overwrite earlier entries).

Check which version of APC you're using. Trunk and the latest release (3.1.5) have a bug where include/require/etc do not process the paths correctly.

I've also seen issues using SHM instead of MMAP (APC defaults to MMAP, and SHM needs recompilation, so unless you've re-compiled it, you should be OK).

spacereactor: you'll probably see better APC hit rates if you change apc.ttl to 0 (which means cache permanently). I also set apc.stat to 0 (the downside is restarting apache after every release, because it won't recognise changes to php files once the file's been cached). APC usually bundles a php-script called apc.php, which you can use to check the hit rate - it's a good way to see if SHM is appropriate for the environment.

--
Marcus Deglos
Founder / Technical Architect @ Techito.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: