Php – How to check APC cache is working

alternative-php-cachePHP

I have Debian server with php5-fpm and nginx installed.

Just installed apc cache:

apt-get install php5-apc

/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart

when I modify any php file and reload it in the browser it shows all changes immediately. Does it mean that APC cache is not running if it does not show cached file?

apt-get remove php5-apc
apt-get install php-apc

didn't help. Any changes in php files are visible immediately. In phpinfo() APC shows up, so, I think everything should be ok.

My questions:

  • How do I check APC cache is running?
  • What is the correct command to install APC cache

apt-get install php-apc
or

apt-get install php5-apc

(both of them works)

Best Answer

How do I check APC cache is running? The best way is to browse apc.php

When I install PHP one of the first things I do is copy the apc.php file into my web root.

cp /usr/share/doc/php-apc/apc.php /var/www/public/apc.php

You can then go to domain.com/apc.php and view what is being cached, clear the cache, check on memory usage etc

You may need to edit apc.php and set a password to access some features but that should be straight forward.

What is the correct command to install APC cache

'apt-get install package' is correct, your package will depend on what version of debian you're using, for example squeeze uses php-apc http://packages.debian.org/squeeze/php/php-apc