Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

Apc don't cache file type, it only cache user type.I tested with localhost, APC cached all file i use on localhost. but it doesn't work on my shared hosting. is it because configure ?

This stats in apc.php APC (3.0.19) enter image description here

on above picture, APC don't cache or use memory. This is configure in phpinfo(); enter image description here

on localhost, i only access http://localhost/test.php. Apc will cache localhost/test.php ( type file ) imediately. but on shared host, i don't see it cache file ( it can cache variable, if i store but don't with file );

    apc_add('APC TEST', '123');
    echo apc_fetch('APC TEST'); //-- it work with this code

i want Apc cache test.php if i access test.php.

Is there a configure make APC can't cache file type or it is limit of shared hosting?.

share|improve this question
Is that after you access something on your site? Like, you opened and browsed php stuff? – coredump Apr 2 '11 at 1:04
I tested in several hours in website at localhost, and shared hosting. APC cache files in localhost but don't on localhost. I can't figure matter. – meotimdihia Apr 2 '11 at 1:29
It is not clear how you know that APC isn't caching. From the picture of APC stats the cache is not used because it hasn't received any requests (uptime of 0 minutes for example). How exactly are you testing the site from localhost and shared host? – uesp Apr 2 '11 at 2:38
Apc is enabled on my shared hosting, because i can write and read variable on Apc cache . ( apc_store() and apc_fetch()). but it don't auto cache file. On localhost, it auto cache any file when i access. – meotimdihia Apr 2 '11 at 3:22

This is almost certainly related to your shared hosting provider. They probably have the website configured to use PHP in CGI mode. This means that each time your server gets a request, it spawns a new process, and once that request is done the process is killed. APC relies on the server having a long-running process that serves up many requests. (Based on the server version in your screenshot, it looks like this is a CPanel server, which makes this situation very likely)

The only way you can fix this is to talk to your hosting provider. They would need to configure your account to use a long running PHP process (fastcgi, php-fpm).. but it's unlikely that they would be willing to do this.

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.