FeaturesWP CloudPricingEE CLIContactMy Account
Features
Team Access & User Permissions
Install
Resources
Community
CLEAR
Tutorials
PHP
PHP’s Zend Opcache Config & Web Viewer
Topics
On this page
-
- Getting Started
- Git and File-System Layout (non-default setup)
- Version Constraints
- Managing Themes and Plugins (for entire WordPress site)
- Updating Themes and Plugins (for entire WordPress site)
- Adding Composer Support to Your Own Themes and Plugins (for developers)
- Using Composer to Manage Own Theme/Plugin Dependencies (for developers)
-
- Assigning Multiple IP Addresses to Single LAN Card
- Disable IPv6 on Ubuntu 12.04
- dsh – distributed shell
- fdupes – find & replace duplicate files with hardlinks
- GPG Keys Cheatsheet
- Increase "Open Files Limit"
- kill all php, nginx, mysql or any kind of processes
- Passwordless Authentication for SSH
- Screen
- search replace in multiple files useing grep xargs sed
- Setup sftp
- sysctl.conf
- Timezone Sync
- Using Google Public DNS on Ubuntu Server
- Using openssl to match private key, cerificate and CSR
- Configure Postfix to Use Gmail SMTP on Ubuntu
- Logrotate Example for Custom Logs
- PHP 5.5, MySQL, Postfix, Nginx and WordPress on Ubuntu
- Serverdensity
- Upgrade Ubuntu 10.04 to 12.04
- Using find and sed to replace strings in multiple files
- Webmin
-
- .my.cnf – mysql user & password
- Analyse slow-query-log using Anemometer
- Improving MySQL Query Cache
- MySQL Query Profiling
- Reset MySQL root password
- tuning-primer.sh – an alternative for mysqltuner
- Using MariaDB 10
- Install/Upgrade to MySQL 5.6 on Ubuntu 12.04 LTS
- Change WordPress Domain Name
- Character Sets and Collations
- Enable innodb_file_per_table
- Enable Remote Access (Grant)
- Installing Percona Toolkit
- Using tmpfs for temporary folder creation
- YARPP and InnoDB
- Convert MyISAM to InnoDB
- Using tmpfs for mysqldump & mysqlimport
- Convert from INNODB to MYISAM
- Analyse slow-query-log using mysqldumpslow & pt-query-digest
- mysqlcheck with cron to optimize automatically
- Using MySQLTuner to Optimize MySQL configuration
-
-
- Directly connect to PHP-FPM
- Generating core-dump for php5-fpm
- GeoIP
- Having php5 and php7 on same system.
- Install Xdebug and configure it with webgrind
- Installation of PHP Code Review Tools
- memcache
- PHP's Zend Opcache Config & Web Viewer
- Setting Sqlite support with PHP
- Using HHVM with PHP-FPM Fallback
- Using Redis for PHP Sessions on Ubuntu Server
- Installing PhpMyAdmin Quickly
- Moving PHP's session storage to tmpfs
- Install Xdebug and configure it with Netbeans
- Nginx – Enable PHP-FPM Status Page
- PHP-FPM: Socket vs TCP/IP and sysctl tweaking
- APC Cache Optimization & Monitoring Using Web Interface
- Checking if PHP/WordPress can send mails
- Debugging PHP Scripts Using slow_log and more
- Increase file upload size limit in PHP-Nginx
- Increase PHP script execution time with Nginx
-
- Performance Optimization
- Remove Query string of css/js files
- Setup ElasticSearch with ElasticPress
- Using Redis for WordPress Object-Cache
- WooCommerce Window Shopping Caching Technique
- Moving WordPress To New Server (Faster)
- Better wp-cron using linux's crontab
- 404 error- Page not Found!!!
- Debugging WordPress with Nginx
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:

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

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

We are using all 3 for now! We will update this post if we add or remove anything from our list.
Setting Sqlite support with PHP
NEXT
Comments
-
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.
-
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.
-
Question is if the vps is a shared vps and used up resources hhow ever memcached option be nice
-
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.
-
@Spazl Here is link – https://ancillary-proxy.atarimworker.io?url=https%3A%2F%2Fdigitalocean.uservoice.com%2F @Michael is talking about.
-
-
-
-
-
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
-
Yep. I check stats pages like per week.
If I see free memory going below 10MB, I increase RAM allocation.
-
What’s happens to things if memory is exhausted though?
Is there a similar tuning script for memcached as well, that you know of?-
@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.
-
-
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.
-
-
-
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
-
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.
-
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.
-
I think Martin is comparing APC’s opcocde caching feature v/s PHP’s new built-in zend opcode cache in terms of memory.
-
-
-
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…
-
Jetpack breaking is unexpected.
Did you try?
opcache.revalidate_freq=0 opcache.consistency_checks=1For 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/
-
-
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!-
I am really clueless. This and every site we are running is using PHP Zend Opcache.
Do you have any ioncube encrypted plugin?
-
-
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 Technologiesthank you thank you thank you
-
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?
-
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.
-
If you are seeing 100% usage in Zend Opcache, simply increase it’s size.
What is your current size?
-
-
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/wwwThen for SFTP…
passwd www-dataSet a password for www-data and use that user over SFTP (not normal FTP).
-
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.
-
You can use HTTP Auth from webserver to protect any URL at server level.
-
-
-
-
Lance
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?
-
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
- Server Setup & Management
- Site Creation & Management
- Create WP Cloud Sites
- Speed & Caching
- Firewall Protection
- Backups & Recovery
- Logs & Monitoring
- Deployments & Developer Tools
- Team Access & User Permissions
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.