• 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

This Article Has Been Shared 212 Times!

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)

  • HHVM WordPress (Nginx Ubuntu Server) Tweaks

    Here are some special HHVM Wordpress (Nginx Ubuntu Server) Tweaks for Page Speed optimization, Compatibility of WordPress Themes and Plugins.

  • Steps To Install Nginx Plus on Ubuntu Server (HP Cloud)

    Here Are the Steps To Install Nginx Plus on Ubuntu Server Running on HP Cloud. Nginx Plus is the Paid Version of Nginx with Extra Features.

  • Cloud and SaaS : Is Cloud Based SaaS Becoming the Mainstream ?

    Cloud Computing is becoming the dominant global trend not only in enterprise IT but also in Private Small Sectors. Better,faster,cheaper is pushing Cloud ahead.

  • Rackspace Deployment Services Early Access Video Guide

    Rackspace Deployment Services Early Access Video Guide Shows How to Setup Rackspace Cloud Server, Load Balancers, Cloud Database in easy clicks from GUI.

  • Points to Check Before Switching to Cloud Computing

    If you work as a IT service provider you need either to explain the benefits of cloud computing or decide to switch own business, some points to check before switching to Cloud.

Additionally, 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

  • What is Configuration Management February 5, 2023
  • What is ChatGPT? February 3, 2023
  • Zebronics Pixaplay 16 : Entry Level Movie Projector Review February 2, 2023
  • What is Voice User Interface (VUI) January 31, 2023
  • Proxy Server: Design Pattern in Programming January 30, 2023

About This Article

Cite this article as: Abhishek Ghosh, "Zend Opcache Optimization for Nginx Ubuntu (HP Cloud)," in The Customize Windows, March 9, 2015, February 6, 2023, https://thecustomizewindows.com/2015/03/zend-opcache-optimization-for-nginx-ubuntu-hp-cloud/.

Source:The Customize Windows, JiMA.in

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT