Script: Install IonCube on Debian VPS

IonCube is a PHP Zend encoding method used to protect and encode PHP files. In order to view encoded php files on your VPS you must have the php ioncube extension installed.
Today we will see how to install the ioncube loader on your Debian or Ubuntu VPS using a simple bash script.



#!/usr/bin/env bash

# Check if PHP CLI is installed
hash php 2>/dev/null || { echo >&2 "The script requires php5-cli but it's not installed.  Aborting."; exit 1; }

# Find the system architecture
DPKG_ARCH=$(dpkg --print-architecture)
if [[ "$DPKG_ARCH" = "i386" ]]; then
elif [[ "$DPKG_ARCH" = "amd64" ]]; then

# Download and extract
wget -q -O - "${ARCH}.tar.gz" | tar -xzf - -C /usr/local 

# Find PHP version
PHP_V=$(php -v)

# Add the IonCube loader to the PHP configuration
echo "zend_extension=/usr/local/ioncube/ioncube_loader_lin_${PHP_VERSION}.so" \
    > '/etc/php5/conf.d/00-ioncube_loader.ini'

# Restart services
for i in php5-fpm nginx apache2;do
    test -x /etc/init.d/$i && /etc/init.d/$i restart

After executing the script, to check if ioncube extension is properly installed , type the following command: “php -v”. The output should be similar to the following:

PHP 5.3.18-1~dotdeb.0 with Suhosin-Patch (cli) (built: Oct 19 2012 08:17:21)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

The script is self explanatory, and it should work on any Debian based system like Ubuntu or Linux Mint.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert linux admins to install this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Install SugarCRM on a CentOS/Fedora/Scientitic Linux VPS
Speed-up your PHP based websites using Zend Optimizer on a CentOS 6 VPS
How to set-up TT-RSS (tiny-tiny RSS) on CentOS 6