How to Install Zend Guard Loader Inside RunCloud Server

What is Zend Guard Loader

Zend Guard Loader is a PHP module that enable PHP to run PHP script encoded by Zend Guard. With Zend Guard Loader, your Web Application inside RunCloud will be able to serve Zend Encoded script. Zend Guard is used to protect PHP script source for proprietary release of a PHP script.

Zend Guard Loader only available for PHP 5.5 and 5.6.

Download, Upload, Extract, Install

To download Zend Guard Loader, you need to be registered to zend. Once you have registered, open this link to download Zend Guard for Linux. Download both PHP 5.5 and 5.6 modules if you want to install to both PHP version. Please make sure you are downloading the 64 bit version of Zend Guard Loader.

Once you have downloaded both files, upload them to your server using SFTP. Please make sure you are uploading them using root user. Replace ip address below with your server’s IP Address.

scp zend-loader-php5.5-linux-x86_64_update1.tar.gz root@<ip address>:~/
scp zend-loader-php5.6-linux-x86_64_update1.tar.gz root@<ip address>:~/

Now login to your server as root to extract both files.

# Login to server
ssh root@<ip address>

# Extract PHP5.5 module
tar -zxvf zend-loader-php5.5-linux-x86_64_update1.tar.gz

# Extract PHP5.6 module
tar -zxvf zend-loader-php5.6-linux-x86_64_update1.tar.gz

The extracted files contains two modules which is the ZendGuardLoader.so and opcache.so. To use Zend Guard Loader, you need to replace the default opcache modules with the one supplied from the downloaded file.

Install Zend Guard Loader for PHP 5.5

# Copy both files to PHP5.5 modules directory
cp zend-loader-php5.5-linux-x86_64/opcache.so /RunCloud/Packages/php55rc/lib/php/extensions/no-debug-non-zts-20121212/opcache_zend_loader.so
cp zend-loader-php5.5-linux-x86_64/ZendGuardLoader.so /RunCloud/Packages/php55rc/lib/php/extensions/no-debug-non-zts-20121212/

# Replace the opcache with provided opcache
replace opcache.so opcache_zend_loader.so -- /etc/php55rc/conf.d/opcache.ini

# Register the zend loader
echo "zend_extension=ZendGuardLoader.so" > /etc/php55rc/conf.d/zendguardloader.ini

# Restart PHP
systemctl restart php55rc-fpm

Install Zend Guard Loader for PHP 5.6

# Copy both files to PHP5.6 modules directory
cp zend-loader-php5.6-linux-x86_64/opcache.so /RunCloud/Packages/php56rc/lib/php/extensions/no-debug-non-zts-20131226/opcache_zend_loader.so
cp zend-loader-php5.6-linux-x86_64/ZendGuardLoader.so /RunCloud/Packages/php56rc/lib/php/extensions/no-debug-non-zts-20131226/

# Replace the opcache with provided opcache
replace opcache.so opcache_zend_loader.so -- /etc/php56rc/conf.d/opcache.ini

# Register the zend loader
echo "zend_extension=ZendGuardLoader.so" > /etc/php56rc/conf.d/zendguardloader.ini

# Restart PHP
systemctl restart php56rc-fpm

Verify The Installation

# Verify for php5.5
/RunCloud/Packages/php55rc/bin/php -m | grep "Zend Guard"

# Verify for php5.6
/RunCloud/Packages/php56rc/bin/php -m | grep "Zend Guard"

If you got any output, then you have successfully installed the Zend Guard Loader inside your server.

Removing the Zend Guard Loader

If you are no longer using Zend Guard Loader, it is wise to remove it from your server because it will make your PHP slower by having unused PHP modules.

Uninstall Zend Guard Loader from PHP5.5

# Change the opcache to original opcache
replace opcache_zend_loader.so opcache.so -- /etc/php55rc/conf.d/opcache.ini

# Remove zend guard loader
rm /RunCloud/Packages/php55rc/lib/php/extensions/no-debug-non-zts-20121212/opcache_zend_loader.so
rm /etc/php55rc/conf.d/zendguardloader.ini

# Restart php
systemctl restart php55rc-fpm

Uninstall Zend Guard Loader from PHP5.6

# Change the opcache to original opcache
replace opcache_zend_loader.so opcache.so -- /etc/php56rc/conf.d/opcache.ini

# Remove zend guard loader
rm /RunCloud/Packages/php56rc/lib/php/extensions/no-debug-non-zts-20131226/opcache_zend_loader.so
rm /etc/php56rc/conf.d/zendguardloader.ini

# Restart php
systemctl restart php56rc-fpm

Verify The Uninstallation

# Verify for php5.5
/RunCloud/Packages/php55rc/bin/php -m | grep "Zend Guard"

# Verify for php5.6
/RunCloud/Packages/php56rc/bin/php -m | grep "Zend Guard"

If you didn’t get any output, then you have successfully uninstall Zend Guard Loader from your PHP.

Share This On
Share on facebook
Share on twitter
Share on linkedin
Share on reddit

Leave a Comment

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

You May Also Like