Search code examples
phpcachingapc

PHP APC configuration, and checking performance


I am having a little issue on checking APC in my VPS host, which is a CentOs 6.5 on a 32bit system, running php-fpm, Nginx and Mysql. To optimize memory, I installed php-apc and configured it according to to this tutorial

Basically, I only changed the things that made the least sense (As this was my first time using caching, and optimization ever, so I left the rest)

So, these are the configurations I changed in /etc/php.d/apc.ini.

extension = apc.so
apc.enabled=1
apc.shm_size=128M
apc.ttl=3600
apc.user_ttl=7200
apc.gc_ttl=3600
apc.max_file_size=1M
apc.stat=1

Now, after starting php, I wanted to know if all is working, and that caching is activated and working, but I am not sure how this is done.

I checked the phpinfo()'s output, and I can see that apc is loaded but other than that, I don't know how to check if it is working at all. According to the php manual I am able to understand apc.enabled = 1 means, apc is working ??

Is there a command or some output to even debug or check on performance of apc ?


Solution

  • apc_cache_info will give you output detailing how the cache is currently configured, hit/miss statistics, and also list the contents of the cache.

    There is also a useful information page provided with the APC PECL package. You can find this on your system by issuing

    locate apc.php
    

    in your unix shell (eg bash). You may need to copy the resulting file to a location in your webserver's root, so you can get to it with a browser.