Enable Zend Optimizer or Zend Guard

In this article, I’ll show you about Zend Guard and Zend Optimizer for PHP, which is currently one of the most widely accepted PHP encoding and obfuscation, and PHP performance-enhancing products out there.

What is Zend Optimizer?

The Zend Optimizer is a free runtime you can use with files encoded by Zend Guard, it can be simply added as a PHP extension into your current PHP php.ini configuration. Zend Optimizer can help speed up the performance and reduce the server demand of your PHP scripts which have been encoded by Zend Guard.

You can read more about Zend Optimizer via the release notes on Zend.com

What is Zend Guard?

Zend Guard works with PHP up to version 5.6. As of PHP version 7, Zend Guard was discontinued. To learn more about Zen Guard, please see the official blog posts from Zend.

Running Zend Guard on your PHP scripts will help encode your scripts to prevent reverse engineering and unauthorized edits to your code, it will also protect your code from unauthorized use, and you can run Zend Guard encoded scripts through Zend Optimizer (with PHP 5.2 and older) to help enhance the performance of your PHP applications as well.

You can find more information about Zend Guard direct from Zend.com as well.

Am I already using Zend Optimizer or Zend Guard?

You can easily check if your website is already using Zend Optimizer or Zend Guard by viewing your PHP settings using a phpinfo.php page.

ZendOptimzer

If you are running PHP 5.2 or older, you should already have Zend Optimzer enabled, and it should look like this:

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

ZendGuard

If you are running PHP 5.3 or newer, you should more than likely already have Zend Guard enabled, and in your phpinfo.php page it should look like this:

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

Enable Zend Optimizer

To use Zend Optimizer, you need to be running PHP 5.2 or older. In a lot of cases you would want to use multiple PHP versions on one account with the help of .htaccess rules, so that you can still use Zend Guard to encode your files. On a shared server you’d change the PHP version your account uses. With a VPS or dedicated server you could follow the steps for how to upgrade PHP using EasyApache, and just choose to downgrade instead.

Typically just switching your PHP version should load the proper Zend product, to be sure though, on your phpinfo.php page you should see this in about the 7th field down when you’re using PHP 5.2 with Zend Optimizer:

Loaded Configuration File: /opt/php52/lib/php.ini

If you instead see something like:

Loaded Configuration File: /home/userna5/public_html/php.ini

Then you have probably at some point followed our steps for making your php.ini file recursive. In which case, you need to make sure you’re editing your /public_html/php.ini file to include the Zend Optimizer includes of:

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

If you have any problems at all getting Zend Optimizer working on your account please contact technical support for further assistance.

Enable Zend Guard

In order to enable Zend Guard on your server, you first need to be sure you’re running PHP 5.3 or newer. If you are on a shared server you can change the PHP version your account uses. If you’re on a VPS or dedicated server with root access, you can upgrade PHP using EasyApache if all of your PHP applications can run without PHP 5.2, or simply contact technical support to also have the ability to switch between PHP versions on your server.

Simply switching PHP versions should load the proper Zend product for you, your phpinfo.php page should read this in about the 7th field down when you’re using PHP 5.3+ with Zend Guard:

Loaded Configuration File: /usr/local/lib/php.ini

If you instead see something like:

Loaded Configuration File: /home/userna5/public_html/php.ini

You probably at some point followed our steps for making your php.ini file recursive. In which case, you need to make sure you’re editing your /public_html/php.ini file to include the Zend Guard includes of:

[Zend] zend_extension=”/usr/local/Zend/lib/Guard-5.5.0/php-5.3.x/ZendGuardLoader.so

If you have any problems with Zend Guard working on your account please contact technical support for further assistance.

You should now hopefully understand a bit more about Zend Optimizer and Zend Guard and how to get your account setup to be able to take advantage of them!

AC
Arnel Custodio Content Writer I

As a writer for InMotion Hosting, Arnel has always aimed to share helpful information and provide knowledge that will help solve problems and aid in achieving goals. He's also been active with WordPress local community groups and events since 2004.

More Articles by Arnel

One thought on “Enable Zend Optimizer or Zend Guard

Was this article helpful? Join the conversation!