Check PHP OPcache usage

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:

# 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!

Author: Joel Carnat

@work Technical Architect and SysAdmin ; @home OpenBSD and FOSS, Karate, Kobudō, Jōdō, Bodyweight workout, Photography & Music

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.