• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here:Home » Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)

By Abhishek Ghosh March 9, 2015 7:43 am Updated on March 9, 2015

Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)

Advertisement

Here is Full Guide to Zend Opcache Optimization for Nginx PHP5-FPM for Ubuntu Server Running on HP Cloud. We Suggest to Use Zend Opcache over APC. Most of Our Guides, like installing Nginx-PHP5-FPM on Rackspace Cloud, installing Nginx-PHP5-FPM on HP Cloud, installing Nginx-PHP5-HHVM on HP Cloud – we already have prepared the installation ready and running with PHP Zend Opcache. So, for this guide on Zend Opcache Optimization for Nginx Ubuntu (HP Cloud); we will not repeat the initial steps for the preparation phase. OPcache is designed to replace the APC module.

 

Zend Opcache Optimization for Nginx Ubuntu : Use OpenStack Snapshot for HP Cloud and Rackspace

 

OpenStack has the Snapshot feature named OpenStack Raksha for HP Cloud and Rackspace. Thus you can keep a live website’s working copy and do these tests on that dev setup spend from Snapshot. It is not exactly hugely risky, but we prefer not to work with a live server.

 

Preparation For Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)

 

SSH to the instance :

Advertisement

---

Vim
1
ssh -i [your-key].pem ubuntu@[ip-address]

First, check whether PHP is ready with Zend Opcache :

Vim
1
php -v | grep OPcache

You should get a proper output like :

Vim
1
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

You can find the opcache.so extension by this command :

Vim
1
2
# step 1
sudo find / -name 'opcache.so'

Now, open this file :

Vim
1
2
# step 2
/etc/php5/mods-available/opcache.ini

you’ll get something like :

Vim
1
2
# step 2.1
/usr/lib/php5/20121212/opcache.so

or, you can open this file :

Vim
1
2
# step 3
nano /etc/php5/fpm/conf.d/05-opcache.ini

This is when we are using PHP5-FPM. If you want to do these for HHVM with PHP5-FPM fallback, you need to work with loaded php.ini file directly. For step 2 way, you need to debug this line on /etc/php5/mods-available/opcache.ini with these :

Vim
1
2
3
# step 4
zend_extension=/usr/lib/php5/20121212/opcache.so
# zend_extension=opcache.ini

That zend_extension=opcache.so versus zend_extension=/usr/lib/php5/20121212/opcache.so has some bug adding those after hundreds of security patches to stop spyware activities! In short, you need to confirm whether Zend Opcache is working or not! Here is a nice OpCache GUI tool’s instruction guide :

Vim
1
https://github.com/PeeHaa/OpCacheGUI/wiki/Installation

It is a bit difficult for the new users. There are easy simple files but they will need some HTTP based protection, else all can vie them. See this fool’s file :

Vim
1
http://pryormedia.net/opcache.php

Do not report to the webmaster! If you keep your opcache.php in this way, anyone can hack! If you are the fool (forgive me!), then block the access either by modifying the PHP file or Nginx config file. Or you can add some adverts on it! It has been indexed by Google with good SERP!
This is better tool as it is CLI based :

Vim
1
http://gordalina.github.io/cachetool/

Now, in case you are using HHVM, that story is newer :

Vim
1
http://docs.hhvm.com/manual/en/ref.opcache.php

From various tests, nicely optimized HHVM with Opcache server can give over 15 times better performance than non optimized. Basically you need to work in a bit dirty way, you need to find the loaded php.ini file directly. It may not be the php.ini file :

Vim
1
php -i | grep 'Configuration File'

Better find all the php.ini file :

Vim
1
locate php.ini

You might get :

Vim
1
2
3
4
5
6
7
8
9
/etc/hhvm/php.ini
/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini
/etc/php5/fpm/php.ini
/etc/php5/fpm/php.ini.save
/etc/php5/fpm/php.ini.save.1
/usr/share/php5/php.ini-development
/usr/share/php5/php.ini-production
/usr/share/php5/php.ini-production.cli

For passing in to another App, we pass can check which php.ini is actively loaded :

Vim
1
php --ini | grep Loaded | cut -d" " -f12

To check all the related php.ini you should run :

Vim
1
php -i | grep "\.ini"

Yeah, it can happen, if you optimize only one file, you’ll not get 100% work. There should be no problem to edit the main file first and then add the needed block of code on all the related php.ini for fail-proof system.

We have not said the all! Run this :

Vim
1
strace -o strace.log php --version && grep php.ini strace.log

If you are getting :

Vim
1
open("/usr/bin/php.ini", O_RDONLY)      = -1 ENOENT (No such file or directory)

then create the path, copy the loaded php.ini there and properly chmod it. PHP is more bad with more difficult setup to optimize to make it somewhat faster. For that reason, some symlinks in this way :

Demo Only Do NOT Run Unless You Understand
Vim
1
ln -s /etc/php5/php.ini php.ini

 

Core Configuration For Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)

 

So far, we have only prepared the server instance for Zend Opcache optimization for Nginx running on Ubuntu.

Basic Settings :

Basic Zend Opcache Optimization for Nginx Ubuntu is This :

commented out in php.ini style
Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; debug this
zend_extension=/usr/lib/php5/20121212/opcache.so
;; debug with
; zend_extension=opcache.so
;; Enables opcache
; opcache.enable=0
opcache.enable=1
;; Enables opcache cli execution like CLI cron
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.validate_timestamps=0
opcache.fast_shutdown=1
; debug for performance
opcache.consistency_checks=1
opcache.max_wasted_percentage = 5
;; debug with value = 1
opcache.use_cwd = 0
opcache.file_update_protection = 0
opcache.revalidate_path = 0
;; debug
opcache.inherited_hack = 1
opcache.max_file_size = 0
opcache.log_verbosity_level = 2
opcache.preferred_memory_model = ""
; opcache.error_log = ""
;; Empty string assumes stderr, you should create the path and chmod
opcache.error_log = "/var/log/error/opcache.log"
;; make sure we have not repeated anything
;; remove the commented out lines

Obviously, run :

Vim
1
2
3
service php5-fpm restart
service hhvm restart
service restart restart

depending on your setup. This is a basic optimization. This can go like this with more :

Vim
1
2
3
4
5
6
7
opcache.use_cwd = 1
opcache.validate_timestamps = 1
opcache.save_comments = 1
opcache.enable_file_override = 0
opcache.revalidate_path = 1
opcache.load_comments = 0
opcache.blacklist_filename string = /var/www/broken.php

The list is endless :

Vim
1
http://php.net/manual/en/opcache.configuration.php

Engine Yard, historically has a set of tools for PHP optimization :

Vim
1
https://github.com/engineyard/ey-php-performance-tools

For WordPress like cms, you should have a thing like this :

Vim
1
https://wordpress.org/plugins/opcache/

 

Zend Optimizer Plus is Zend Opcache Since Mid of March 2013

 

Zend Optimizer+ was renamed to Zend Opcache mid of March 2013. Funnily :

Zend Opcache Optimization for Nginx Ubuntu

Vim
1
https://github.com/zendtech/ZendOptimizerPlus

That has another GUI tool :

Vim
1
https://gist.github.com/ck-on/4959032

Zend Optimizer, unlike Zend Opcache doesn’t load files encoded by Zend Guard. Zend provides another component.

Keep it in mind – do not use both XCache and Opcache. Dual caching will frankly, waste the memory. Zend Optimizer does not work properly with WordPress based websites. XCache is always the best for very good setup, specially physical one with caching by Akamai for page delivery. For virtual servers, cloud servers with less than 16 GB RAM and unknown virtualization software, Opcache works better. XCache works great with a real physical memory. Only Windows Cache can beat XCache. But, XCache has many smaller issues which can be costly for a WordPress setup. Practical fact about WordPress is that, without W3TC and Nginx caching system, HHVM, WordPress can not be served faster like Python. Opcache is better option for the most common virtual setups.

Tagged With opcache
Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)

  • Nginx WordPress Installation Guide (All Steps)

    This is a Full Nginx WordPress Installation Guide With All the Steps, Including Some Optimization and Setup Which is Compatible With WordPress DOT ORG Example Settings For Nginx.

  • Install WordPress on Nginx With HHVM on Ubuntu Cloud Server

    Here is Step by Step Guide to Install WordPress on Nginx With HHVM on Ubuntu Cloud Server. This simple and most easy standalone HHVM only guide. We talked about HipHop Virtual Machine or HHVM in order article. Normally, with Nginx, we use PHP5-FPM. This guide is how to install WordPress on Nginx with HHVM on […]

  • WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud

    Here is a Step by Step Guide on Setting Up WordPress Multisite on Nginx on Ubuntu 14.04 on HP Cloud with All Commands and the Configuration.

  • HipHop Virtual Machine (HHVM)

    HipHop Virtual Machine (HHVM) is a process virtual machine developed by Facebook, serves as an execution engine for PHP, based on JIT.

performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (24.3K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Hybrid Multi-Cloud Environments Are Becoming UbiquitousJuly 12, 2023
  • Data Protection on the InternetJuly 12, 2023
  • Basics of BJT TransistorJuly 11, 2023
  • What is Confidential Computing?July 11, 2023
  • How a MOSFET WorksJuly 10, 2023
PC users can consult Corrine Chorney for Security.

Want to know more about us?

Read Notability and Mentions & Our Setup.

Copyright © 2023 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy