InMotion Hosting

The Official InMotion Hosting Blog

How To: Enable Zend Optimizer

The Zend Optimizer is a free application can boost the performance of your PHP sites. It works by going over your code and optimizing it for faster execution. This means your site can load faster for your users while also utilizing less of the server resources.

zend_logo

Zend Optimizer can be enabled on servers with PHP 5.2 or higher (this includes most of our servers). To enable this feature, first add the two lines below to your .htaccess file in order to enable use of custom PHP settings. Be sure to replace [username] with your actual cPanel username.

suphp_configpath /home/[username]/public_html
AddHandler application/x-httpd-php52 .php

Next, you will need to enable the Zend Optimizer extension by adding the following line to your custom php.ini file (read http://www.inmotionhosting.com/support/website/general-server-setup/update-local-php-settings for more information on how to do this). This line can be added anywhere, though we recommend having it at the bottom of the file.

zend_extension=/opt/php52/lib/php/extensions/no-debug-non-zts-20060613/ZendOptimizer.so

If configured correctly, a phpinfo page will then display “with Zend Optimizer v3.3.9″ as one of the available Zend modules. More information about creating a phpinfo page is available at http://www.inmotionhosting.com/support/website/general-server-setup/create-phpinfo-page-to-see-php-settings.

14 thoughts on “How To: Enable Zend Optimizer

  1. Crystal

    I tried this several times on my VPS hosting account to no avail. The change to my .htaccess file prompted my browser to download pages instead of loading them in the browser.

    My website is in the root folder (public_html). Could this have something to do with the error?

    suphp_configpath /home/ccgree5/public_html
    AddHandler application/x-httpd-php52 .php

    Reply
  2. Crystal

    I may have figured it out. By changing this:
    AddHandler application/x-httpd-php52 .php
    to this:
    AddHandler application/x-httpd-php5 .php

    My website can now load without forcing download of the file. But on my phpinfo.php page it is not showing Zend Optimizer listed in the information block:

    This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies

    Can you help?

    Thank you,
    Crystal

    Reply
    1. Andrew Noruk

      Hi Crystal,

      This article was giving instructions for how to use Zend Optimizer on our business hosting servers which already have Zend Optimizer installed on the server as well as configured with those specific versions of PHP.

      Since you indicated that you are using your own VPS, it is possible that you need to actually install Zend Optimizer on the server (not just tell PHP to use it). We don’t offer technical support through our blog, but our support team would be happy to help you out! Visit http://www.inmostionhosting.com/support to get in touch. If you’d like to try doing it yourself, you can check out this post on the CPanel forums which asks a similar question http://forums.cpanel.net/f34/zend-optimizer-not-installed-192941.html.

      Reply
    2. Jacob Nicholson

      Hey Crystal, and also Thomas, sorry for the problems.

      You are both experiencing problems getting Zend Optimizer loaded on your websites because you’re both using PHP 5.3 and Zend Optimizer only has support up to PHP 5.2 at the moment. If your account is using PHP 5.3 you should have Zend Guard more than likely already enabled on your account as well.

      You can read about the differences, and how to get things working in both of your particular situations, by following the steps in our guide on how to enable Zend Optimizer or Zend Guard.

      If you run into any further problems, please feel free to comment on that article and we’ll be glad to review our instructions to ensure they are proper.

      - Jacob

      Reply
    1. Andrew Noruk

      The .htaccess file allows you to enable features and update settings for your hosting environment, but it’s not a required file so it may not already exist. If you cannot see a .htaccess file in the directory under which you want to enable the Zend Optimizer you can simply create a new file with that name and add the settings as needed.

      Reply
    2. Jacob Nicholson

      Hey Thomas,

      If you can’t locate your .htaccess file in the cPanel File Manager, ensure that you have the option Show Hidden Files selected. You might need to simply create this file as well if you don’t already have one. You can follow our guide on where is my .htaccess file for full detailed instructions on how to accomplish this.

      Hope that helps!

      - Jacob

      Reply
  3. Steve

    AddHandler application/x-httpd-php52 .php

    Adding that line seems to break something in the config. When I add it the browser tries to download a page rather than display it.

    Reply
  4. JoJJJ

    I did not need to do that php.ini file change to make this work in my PHP 5.3. In fact, it worked without a php.ini file – at least “with Zend Optimizer v3.3.9″ appeared in my phpinfo.php page after making the .htaccess change. Hope this cuts down my CPU usage some.

    Reply
    1. Jacob Nicholson

      Hello JoJJJ, and thanks for your comment.

      If you’re using the default php.ini file on your account, and you’re on a PHP 5.2 server, then Zend Optimizer should be available more than likely already.

      If you’re running PHP 5.3 or higher, than Zend Guard would more than likely already be enabled on your account.

      Simply having the PHP Zend Optimizer module running on your account will not cut down on the CPU usage of all of your PHP scripts, but it will help with the performance of scripts encoded with Zend Guard.

      You can read my guide on Zend Optimizer and Zend Guard for more information on how everything works.

      - Jacob

      Reply
  5. Michael

    Thank you very much for this great tutorial. Is this tutorial for shared hosting users or fo dedicated and VPS users? If its for shared users why is it not enabled by default for all of your servers? Will this work for users using php 5.3 and above because in the code I can see php 5.2

    Reply
    1. Jacob Nicholson

      Hello Michael, and thanks for the comment.

      As I’ve mentioned in a few comments above, I have a separate article with more in-depth information for Zend Guard and Zend Optimizer that goes over how to enable either, as it’s based on the version of PHP you’re running on your server.

      The large majority of all of our shared hosting customers should be able to take advantage of Zend Optimizer when using PHP 5.2 and the default server’s php.ini file. If using PHP 5.3 then Zend Guard should be enabled by default.

      Customers on a VPS or dedicated server can use the instructions in that article to ensure one or the other is enabled on their account. It’s also important to point out that Zend Optimizer won’t speed up every PHP script that you have, but the ones that have been encoded by Zend Guard.

      Please let us know if you have any further questions.

      - Jacob

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>