Aug 12, 2011

apc only working for apc.php


I am running PHP 5.3.4, Apache 2.0.63 and APC 3.1.7 on my VPS with CentOS 5.

When I open up apc.php and go the the system cache entries tab, it is telling me that the only file in the cache is apc.php. I have accessed multiple other files in the same directory and still it seems like they aren’t getting cached.

I have played with apc_store and apc_fetch. I can store and fetch variables from the same request but not across multiple requests.

I have searched all over the web and turned up nothing that helped me out. I thought I had figured it out once when someone claimed that a but in APC 3.1.6 was causing the issue. I downloaded 3.1.7 and built it from source…no improvement. I still had the same issue. I have restarted the httpd service multiple times with no success.

Any suggestions what to try and what might be wrong?


Are you using mod_fcgid? If so, don’t. mod_fcgid doesn’t support PHP’s child-spawning capability, so it will spawn a new PHP if there are multiple requests, and each PHP spawned by mod_fcgid will have its own opcode cache (along with a bunch of useless children if you enabled them in PHP’s wrapper script).

If you’re using mod_fastcgi, then you’ll need to check that mod_fastcgi is only starting one PHP process, and that one PHP process is starting enough children to handle your load. This blog post is a pretty good rundown of the whole thing, though it’s specifically for using suexec and getting separate fastcgi processes for each user, you’ll need to tweak it to get one fastcgi process for the entire server if that’s what you want.

If you’re using mod_php5 then it should Just Work, since the APC cache is created by apache.

If you’re using CGI without either mod_fastcgi/fcgid, then your PHP executable exits after every single request, taking its opcode cache with it.

Related posts:

  1. APC configuration on Ubuntu 10.4. Problem with apc.shm_size, apc.shm_segments and Apache
  2. In APC+PHP, how much RAM is too much? Is it okay to set apc.shm_size to many GB?
  3. is there any point running APC **and** memcached concurrently
  4. Enabling APC causes internal server error
  5. APC cache making apache consume all CPU usage


  • Wow! This blog looks exactly like my old one! It’s on a totally
    different subject but it has pretty much the same layout and design.

    Wonderful choice of colors!

  • You are so interesting! I don’t think I’ve read something like this before.
    So nice to find someone with a few genuine thoughts on this topic.
    Really.. thanks for starting this up. This site is something that’s needed on the web,
    someone with a little originality!

  • They are very lovely, durable, and they are low
    cost so it is a great option for your home dcor. This could cost thousands
    of dollars or you could just replicate your own. Many
    are dedicated to their respective work and profession just to fulfill that goal.

  • Feeding too muhch healthy protein to a pet with
    advanced kidney disease attorneys condition can result in uremia, a syndrome caused by quite high creatinine and BUN (urea) levels that causes
    queasiness, vomiting, loss of appetite, as ell as

  • Wow, that’s what I was seeking for, what a data! present here at this website,
    thanks admin of this web site.

  • An impressive share! I have just forwarded this onto a colleague who has
    been conducting a little homework on this. And he in fact bought me
    breakfast simply because I discovered it for him… lol.
    So let me reword this…. Thanks for the meal!! But yeah, thanks for spending the time to
    discuss this subject here on your blog.

Leave a comment