Check PHP OPcache usage

       115 words, 1 minutes

I wondered how my enabled OPcache was used. An easy way to check is to use rlerdorf’s OPcache Status page.

The installation is straight forward. Simply download¬†opcache.php from GitHub and install it on the PHP enabled Web Server. Then, you’ll get something like:

You’ll be able to see if the cache is well used and if you need to allocate more memory. If so, on OpenBSD, you can configure something like:

<pre># cat /etc/php-5.6/opcache.ini

If using Apache HTTP Server, the script access can be protected using the Location and Require keywords:

Alias "/opcache-status.php" "/home/scripts/opcache-status.php"
<Location "/opcache-status.php">
  Require all denied
    Require ip 127
    Require ip 10.0.0

And that’s all!