PHP’s Zend Opcache Config & Web Viewer

PHP 5.5. has zend opcache support in core. Since APC is not updated from long time, we made a switch to new Zend Opcache. Below is our config and web-based stats viewer.

PHP’s Zend Opcache Config

In your php.ini or depending on your PHP version

/etc/php5/fpm/conf.d/05-opcache.ini

or /etc/php/7.0/mods-available/opcache.ini

zend_extension=opcache.so
opcache.memory_consumption=512
opcache.max_accelerated_files=50000

;following can be commented for production server
opcache.revalidate_freq=0
opcache.consistency_checks=1

Web Viewer

Unlike APC, for Zend Opcache there are plenty of web-based viewer. May be reason being zend opcache’s official status has something to do with it. Below is list to choose from.

#1. Opcache-Status by Rasmus Lerdorf

This is by PHP creator himself. Very beautiful.

Installation

cd /var/www/example.com/htdocs
wget https://raw.github.com/rlerdorf/opcache-status/master/opcache.php

Screenshot:

rlerdorf-opcache-status

#2. opcache-gui by amnuts

Responsive. Feature-rich. Notably option to enable real-time stats and and option to reset/flush opcache.

If you are going to use this, make sure it is protected by some security layer.

Installation:

cd /var/www/example.com/htdocs/
wget https://raw.github.com/amnuts/opcache-gui/master/index.php -O op.php

Screenshot:

amnuts-opcache-gui

#3. ocp.php by ck-on

Has best way to analyse/explore file-based cache. UI is more old-style.

Installation:

wget https://gist.github.com/ck-on/4959032/raw/0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb/ocp.php

Screenshot:

ck-Opcache-Control-Panel

We are using all 3 for now! We will update this post if we add or remove anything from our list.