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_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.
- APC configuration on Ubuntu 10.4. Problem with apc.shm_size, apc.shm_segments and Apache
- In APC+PHP, how much RAM is too much? Is it okay to set apc.shm_size to many GB?
- is there any point running APC **and** memcached concurrently
- Enabling APC causes internal server error
- APC cache making apache consume all CPU usage