2

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)

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
iscna
  • 23
  • 1
  • 1
  • 3

1 Answers1

3

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

Drew Khoury
  • 4,637
  • 8
  • 27
  • 28
  • Thanks. Looks that it is working. It shows: cached files: 2. But what is "hits"? It increases +4 every time when I reload apc.php file. – iscna Apr 07 '13 at 11:30
  • APC should update as your PHP files update so what you're experiencing sounds normal. Hits are when the requested page was found in the cache, misses are when it wasn't. – Drew Khoury Apr 07 '13 at 11:36
  • OK, but it's strange that I refresh page once but hits updates +4. – iscna Apr 07 '13 at 11:41
  • Actually hits more accurately refers to "how many objects were already in the cache and were used" so it might be counting one page as multiple objects. You might be able to run a number of tests with some hello world examples and clearing the cache. Maybe the page you're hitting is including other pages or scripts and that is counting as multiple objects. – Drew Khoury Apr 07 '13 at 11:49