FeaturesWP CloudPricingEE CLIContactMy Account

Features

Team Access & User Permissions

Server Setup & Management

Site Creation & Management

Deployments & Developer Tools

Firewall Protection

Speed & Caching

Backups & Recovery

Logs & Monitoring

Create WP Cloud Sites

All Features

Read Documentation

Install

Installation Guide

FAQ

Roadmap

Explore EE CLI

Resources

Commands

Handbook

Blog

Community

Forum

EasyExperts

Tutorials

Subscribe

Github

CLEAR

Start For Free

separator Tutorials separator PHP separator PHP’s Zend Opcache Config & Web Viewer

Topics

On this page

PHP's Zend Opcache Config

Web Viewer

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://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Fraw.github.com%2Frlerdorf%2Fopcache-status%2Fmaster%2Fopcache.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://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Fraw.github.com%2Famnuts%2Fopcache-gui%2Fmaster%2Findex.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://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Fgist.github.com%2Fck-on%2F4959032%2Fraw%2F0b871b345fd6cfcd6d2be030c1f33d1ad6a475cb%2Focp.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.

memcache

PREVIOUS

Setting Sqlite support with PHP

NEXT


Comments

  1. Spazl Avatar

    Spazl

    October 16, 2013

    Hi i really like your tests on php5.5 wish my shared hosti g had it installed. As well be able to use wordpress with memcached setup to really have a performance boost even tough shared hosting with a cdn setup is really fast.

    1. Rahul Bansal Avatar

      Rahul Bansal

      October 17, 2013

      Why wish when you can get VPS with SSD at $5/month from https://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Fwww.digitalocean.com%2Fpricing

      CDN only helps offloading static content. Nginx, PHP & VPS can speed-up entire site at many different levels.

      1. Spazl Avatar

        Spazl

        October 17, 2013

        Question is if the vps is a shared vps and used up resources hhow ever memcached option be nice

        1. Michael Nordmeyer Avatar

          Michael Nordmeyer

          January 19, 2014

          It’s a KVM based VPS which means you’re getting guaranteed resources. I’m testing the smallest Digital Ocean VPS right now.

          If you want to know what could be missing try Digital Ocean’s UserVoice to see what other people are missing.

          1. Rahul Bansal Avatar

            Rahul Bansal

            January 22, 2014

            @Spazl Here is link – https://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Fdigitalocean.uservoice.com%2F @Michael is talking about.

  2. Martin Avatar

    Martin

    October 29, 2013

    It’s actually wise to use one of these web based viewers so you can better adjust cache values, depending on your configuration. I like the live feed of the opcache-gui by amnuts, myself

    1. Rahul Bansal Avatar

      Rahul Bansal

      October 30, 2013

      Yep. I check stats pages like per week.

      If I see free memory going below 10MB, I increase RAM allocation.

      1. Martin Avatar

        Martin

        October 31, 2013

        What’s happens to things if memory is exhausted though?
        Is there a similar tuning script for memcached as well, that you know of?

        1. Rahul Bansal Avatar

          Rahul Bansal

          January 22, 2014

          @Martin Any kind of caching mechanism starts flushing cached entries as soon as storage limit is reached.

          Please check our memcache config here – https://e71a1d5d-e22b-4c34-a1b4-1f6cae4bcd26.atarimworker.io/tutorials/php/memcache/

          @Michael Agree with you. I am more concerned about hit rate. About RAM, I try to give away as much as possible to caches.

      2. Michael Nordmeyer Avatar

        Michael Nordmeyer

        January 19, 2014

        I’d rather look at the hit rate. Depending on your site’s content you’ll come to a point where the cacheable amount of data is larger than your server’s memory.

  3. Martin Avatar

    Martin

    October 31, 2013

    An interesting set of observations between APC and Zend Opcache which suggests Opcache is a memory hog and not as effective as APC. Just thought I’d go digging a bit

    1. Rahul Bansal Avatar

      Rahul Bansal

      November 1, 2013

      How did you conclude that? APC also caches user data by the way. So make sure you are not using APC user-cache while running any benchmarks.

    2. Michael Nordmeyer Avatar

      Michael Nordmeyer

      January 19, 2014

      The problem with APC and it’s user cache is that the cache is created n times for n PHP processes like php-fpm or Apache process. If you want to scale you need lots of processes to serve the increasing amount of users. That’s why one cache (e.g. memcache) for n PHP processes is more economically.

      1. Rahul Bansal Avatar

        Rahul Bansal

        January 22, 2014

        I think Martin is comparing APC’s opcocde caching feature v/s PHP’s new built-in zend opcode cache in terms of memory.

  4. lorenzo noccioli Avatar

    lorenzo noccioli

    February 16, 2014

    i tried most of caching tool to increase my site performance (and reduce my server load) but i wasn’t able to find anything “good”, i have a vps with some site on it (wordpress, custom made cms, and so) and no caching system was good, lastly i tried zend opcache, and it made the load of server dramatically drop, but some thing in wordpress were broken (jetpack stats for example) and a “hand made” site loaded partially and become useless (i guess it is something about ajax, but i have no idea on where to check)… so i reverted, and that is really a pity, because using opcache it was all so fast and i have a real unloaded server…

    1. Rahul Bansal Avatar

      Rahul Bansal

      February 17, 2014

      Jetpack breaking is unexpected.

      Did you try?

      opcache.revalidate_freq=0 opcache.consistency_checks=1

      For non-logged in users, if your PHP app is on Nginx, try fastcgi-cache – https://e71a1d5d-e22b-4c34-a1b4-1f6cae4bcd26.atarimworker.io/wordpress-nginx/tutorials/single-site/fastcgi-cache-with-purging/

  5. popEating Avatar

    popEating

    February 17, 2014

    thank you rahul,
    i tried your suggestion, but all the wp-admin site become useless (page unavailable) with opcache installed, and some other site i host arent working properly; it’s really a pity beacuse on fronte end side, opcache really speed up!

    1. Rahul Bansal Avatar

      Rahul Bansal

      February 19, 2014

      I am really clueless. This and every site we are running is using PHP Zend Opcache.

      Do you have any ioncube encrypted plugin?

  6. popEating Avatar

    popEating

    February 17, 2014

    Following your instructions, i updated to php 5.5 and i managed to have this:
    PHP 5.5.9-1+sury.org~precise+1 (cli) (built: Feb 13 2014 15:53:53)
    Copyright (c) 1997-2014 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

    thank you thank you thank you

  7. Charlie Pryor Avatar

    Charlie Pryor

    March 6, 2014

    I’m a bit confused here… how to I put some security on these pages? I don’t need everyone being able to see them. How do I limit access to just me, like I did with phpmyadmin?

    Also… after installing easyengine and using it… I love it. Thanks you guys. One problem I have though is that WordPress now asks over and over again for FTP settings in order to do anything for me. I have to change W3TC settings manually (it warns me to make changes), and WordPress themes and plugins will not update without that information.

    I figured this easy-to-install package wouldn’t have that issue. It does likely have to do with the fact that I imported my old database from my other host into this site. How do I fix it?

    1. Charlie Pryor Avatar

      Charlie Pryor

      March 6, 2014

      Also, as an added note… It looks like my RAM is at 100% usage. How can I stop that from happening? I have only 1GB of RAM on the server, and I have the “ideal” cache settings in W3 (using memcache). Am I simply under-powered, or is my settings messed up? It’s the $10 box at Digital Ocean.

      1. Rahul Bansal Avatar

        Rahul Bansal

        March 7, 2014

        If you are seeing 100% usage in Zend Opcache, simply increase it’s size.

        What is your current size?

    2. Rahul Bansal Avatar

      Rahul Bansal

      March 7, 2014

      You can use HTTP AUTH to protect these pages. If you are using EasyEngine, then these pages must be under `/ee` which is already protected location.

      For all file-transfer purpose, you should use `www-data` user (if following my tutorials). Make sure you chown all files under `/var/www` to `www-data` user/group so your FTP issue might get fixed.

      cd /var/www 
      chown -R www-data: /var/www 
      

      Then for SFTP…

      passwd www-data
      

      Set a password for www-data and use that user over SFTP (not normal FTP).

      1. Charlie Pryor Avatar

        Charlie Pryor

        March 13, 2014

        Not for file transfer purposes. I mean, when I visit http://pryormedia.net/opcache.php – I can see it. It’s publicly viewable. I’m sorry to ask this, as I’m sure it’s like Linux 101 stuff… but what can I do to password protect this viewing/page? Restrict it to a username and password. What are the steps I can take? I know they are probably simple, but I don’t know the linux commands to use. Thank you for your time.

        1. Rahul Bansal Avatar

          Rahul Bansal

          March 14, 2014

          You can use HTTP Auth from webserver to protect any URL at server level.

  8. Lance Avatar

    Lance

    March 24, 2014

    I refered to your article before actually having our server used opcache. We now have one, and phpinfo indicates that its up and running, but its not actually caching anything. Aside from the default config, I only edited minimum config variables as suggested in the recommended settings: http://www.php.net/manual/en/opcache.installation.php

    Someone at stackoverflow has the same problem, but noone is answering. The server is mint, PHP has just been upgraded from 5.4 to 5.5.10. Where do you think I should start looking to fix this?

    1. Rahul Bansal Avatar

      Rahul Bansal

      March 24, 2014

      Try using config I posted in above article. Use site for a while. Check opcache stats again from webserver.

      You should see cache usage. If not, there could be some issue with php-build as config part is very small.

      I am not sure how did you install php, but if you are using wordpress and nginx – try http://rtcamp.com/easyengine . PHP it installs definiely have zend opcache cache working.

Features

Useful Links

Product

Other Products

Subscribe for curated product updates, tips, and announcements.

"*" indicates required fields

X/Twitter

This field is for validation purposes and should be left unchanged.

Email*

SIGN ME UP

Δ


© rtCamp, since 2009. All rights reserved.

Powered by