CodeClerks

PHP: How to tell if apc is working?



Enter a reason for deleting this comment

PHP: How to tell if apc is working?

I'm running nginx+php-fpm and I had the apc.ini loading the apc.so library. There was no other config so I added this config to the apc.ini file:

extension=apc.so
apc.enabled=1
apc.shm_size=2G
## PHP file cache 1 hour ##
apc.ttl=3600

## User cache 2 hour ##
apc.user_ttl=7200

## Garbage collection 1 hour ##
apc.gc_ttl=3600
apc.max_file_size=1M

## check if the script has been changed ##
apc.stat=1

The site feels faster so I think it is working but I'm completely unsure if it is or not. How do I tell if APC is working? Something like the memcache stats that I can see somewhere?

Comments

Void

APC has cache info just like memcache - apc_cache_info() Just dump it using print_r in a script and you'll be able to see the stats.

<?php
print_r(apc_cache_info());
?>

This shows you the stats and that it is working or not. You should also be able to do a php_info() and see APC there as well. 



Enter a reason for deleting this comment