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
# RoseHosting.com

# 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
  ARCH="x86"
elif [[ "$DPKG_ARCH" = "amd64" ]]; then
  ARCH="x86-64"
fi

# Download and extract
wget -q -O - "http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_${ARCH}.tar.gz" | tar -xzf - -C /usr/local 

# Find PHP version
PHP_V=$(php -v)
PHP_VERSION=${PHP_V:4:3}

# 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
done

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.

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>