Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Drupal site running on a VPS at Linode with PHP 5.2.10 and APC 3.1.6.

It never caches more than about 25 files and barely uses any of its available memory. Drupal has hundreds of PHP files. I have another server where APC seems to work well and does indeed cache hundreds of files. The only difference with that site is that it runs Ubuntu 10.04 and php 5.3.2. The config settings are the same.

What could be wrong? I'll paste the config from apc.php below. This is after hitting multiple parts of Drupal.

APC Version 3.1.6
PHP Version 5.2.10-2ubuntu6.5
APC Host
Server Software Apache/2.2.12 (Ubuntu)
Shared Memory   1 Segment(s) with 32.0 MBytes
(mmap memory, pthread mutex locking)
Start Time  2010/12/02 11:32:17
Uptime  3 minutes
File Upload Support 1
File Cache Information
Cached Files    21 ( 1.4 MBytes)
Hits    169
Misses  21
Request Rate (hits, misses) 1.00 cache requests/second
Hit Rate    0.89 cache requests/second
Miss Rate   0.11 cache requests/second
Insert Rate 0.17 cache requests/second
Cache full count    0
User Cache Information
Cached Variables    0 ( 0.0 Bytes)
Hits    0
Misses  0
Request Rate (hits, misses) 0.00 cache requests/second
Hit Rate    0.00 cache requests/second
Miss Rate   0.00 cache requests/second
Insert Rate 0.00 cache requests/second
Cache full count    0
Runtime Settings
apc.cache_by_default    1
apc.canonicalize    1
apc.coredump_unmap  0
apc.enable_cli  0
apc.enabled 1
apc.file_md5    0
apc.file_update_protection  2
apc.gc_ttl  3600
apc.include_once_override   0
apc.lazy_classes    0
apc.lazy_functions  0
apc.max_file_size   1M
apc.num_files_hint  1000
apc.report_autofilter   0
apc.rfc1867 0
apc.rfc1867_freq    0
apc.rfc1867_name    APC_UPLOAD_PROGRESS
apc.rfc1867_prefix  upload_
apc.rfc1867_ttl 3600
apc.shm_segments    1
apc.shm_size    32M
apc.slam_defense    1
apc.stat    1
apc.stat_ctime  0
apc.ttl 0
apc.use_request_time    1
apc.user_entries_hint   4096
apc.user_ttl    0
apc.write_lock  1
share|improve this question

Increase these two values in the config file: apc.shm_segments 1 apc.shm_size 32M

you'll need to restart php/apache to see the effect.

share|improve this answer
Thanks but that didn't help. I tried making apc.shm_segments=5 and apc.shm_segments=48M but no real change. I didn't mention it but my other server where APC works has apc.shm_segments=48M but that's because it really does use memory. This server never uses more than about 1.5MB – tetranz Dec 2 '10 at 17:17
I hate to just give up but I've decided to try xcache and that works very nicely. About 450 files cached now. – tetranz Dec 2 '10 at 19:28

This might be a bug with apc. Or it might be in the webserver, but this is happening to other folks using drupal.

share|improve this answer
Update: its a bug with APC 3.1.5/3.1.6 in combination with php 5.2.x. You can either upgrade apc to the svn repository version, upgrade php, or rollback apc. – Mixologic Dec 25 '10 at 21:38

Give APC much more memory Start with something like 1Gb and check how it is used. APC must have more memory than it actually use.

APC Will not cache files bigger than 1M, you can safely increase this option to 20M apc.max_file_size 1M

Never use a TTL of 0 apc.ttl=7200 apc.user_ttl=7200

You can check my answer to this question (second to last)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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