Recommended VPS Complete list of best VPS hosting providers.

How to Install Zend Optimizer On CentOS 6 with Apache

How to install Zend Optimizer with Zend Guard Loader on CentOS 6 Server – In this tutorial I am using a VPS node from DigitalOcean running CentOS 6.4 32-bit as the main OS to act as Linux part in my LAMP box (Linux, Apache, MySQL and PHP). I will show you in step by step method how to install Zend Optimizer extension on your CentOS 6.x server running Apache as its main web server. For your information, Zend Guard Loader is a free runtime application that enables PHP to run the scripts encoded by Zend Guard. It can be freely used by anyone looking to run encoded applications.

What you’ll need?

A CentOS server running Apache. Read how to setup a LAMP stack on CentOS here or catch up all CentOS-related articles here.

How To

Step 1 – Login to your server and follow my previous guide about Basic setup for CentOS before you build a live web server. You may and may not follow that tutorial but if you followed, it will give you some basic security tweak to your server.

Before you proceed to the next steps, it is better to explain that all commands in this tutorial are written without the “sudo” prefix. However if you disabled root login and you logged in using another username with root privilege, you can add the “sudo” prefix all by your self. Alternatively you can simply type su, hit Enter and type in your password twice to switch login as root.

switch-root-login

You may also need to type this command to go to the root directory:

cd ~

Step 2 – Check what version of php is running on your server. Do this:

php -v

you’ll see an output something like this:

check php version

The command above used to check which php version is running. In my case is PHP v5.3.3 or simply PHP 5.3.

Step 3 – Now you have to download Zend Guard package appropiate to the version of PHP you have and type of operating system your server has (it is Linux but whether it is 32-bit or 64-bit). Go ahead grab the package from:

http://www.zend.com/en/products/guard/downloads

From there do not forget to choose Linux then pick up the one suitable with your server which in my case I have to download Zend Guard Loader 5.5 32-bit for PHP 5.3 .

download zend

You may also need to login or register for an account first. It’s free. Once the dialog box to download the needed package appears, simply copy its url to use with wget in your server.

download link

or use this shortcut:

Download URL (direct link) for Zend Guard Loader:

Zend Guard Loader (Runtime for PHP 5.4) 64-bit:

http://downloads.zend.com/guard/6.0.0/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz

Zend Guard Loader (Runtime for PHP 5.4) 32-bit:

http://downloads.zend.com/guard/6.0.0/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz

Zend Guard Loader (Runtime for PHP 5.3) 64-bit:

http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz

Zend Guard Loader (Runtime for PHP 5.3) 32-bit:

http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz

Step 4 – Now back to your server. Use wget command to grab the Zend loader package:

wget http://downloads.zend.com/guard/5.5.0/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz

screenshot:

wget

Step 5 – Now extract it using tar command:

tar xzvf name-of-package-file.tar.gz

In my case is:

tar xzvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz

screenshot:

tar

Step 6 – Now enter the the new folder extracted and find the ZendGuardLoader.so file. See example below (use cd command)

zendloader.so

Step 7 – Then copy ZendGuardLoader.so file to:

32-bit server: /usr/lib/php/modules

64-bit server: /usr/lib64/php/modules

which in my case I use 32-bit:

cp ZendGuardLoader.so /usr/lib/php/modules

screenshot:

zendguardloader.so

Step 8 – Now create ZendGuard.ini file inside /etc/php.d directory:

nano /etc/php.d/ZendGuard.ini

Step 9 – Then add following lines inside that file:

; Enable Zend Guard extension
zend_extension=/usr/lib/php/modules/ZendGuardLoader.so
zend_loader.enable=1

if your server is 64-bit then use:

; Enable Zend Guard extension
zend_extension=/usr/lib64/php/modules/ZendGuardLoader.so
zend_loader.enable=1

example of mine:

zend .ini

Once done, hit Control+O to save then Control+X to exit.

Step 10 – That’s it. Now you can restart Apache service:

service httpd restart

You can check it again using php -v command and you should now see something like this:

zend loader installed

That’s it.

Note: If you also wanted to install IonCube PHP Loader, make sure to load it before Zend guard Loader (Ioncube loader first then Zend loader). Otherwise it may return error.

7 Comments

Add a Comment

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

Get more stuff like this
in your inbox

Subscribe and get interesting stuff plus faster updates to your email.