How to Install Ioncube Loaders

It’s a common practice to encode your PHP code while developing web apps, and in the hosting world one of those companies is WHMCS and their software. In order to decode and execute the PHP from the server side, you must have ioncube loaders enabled on your PHP server.

Install IonCube Loaders on cPanel and plain CentOS/RHEL servers

In order to install ioncube loaders you must have root access to your server

First step, before installing is checking if you already have ioncube loaders installed on your server. Fastest way to do this is by running php -v, example:

[[email protected]:~]php -v
PHP 5.4.44 (cli) (built: Aug 13 2015 05:07:21) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd.
[[email protected]:~]

As you see, if you have Ioncube loaders enabled you should see something like:

with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd

You can also do it using a phpinfo file:

<?php phpinfo();?>

Installing IonCube Loaders with cPanel & WHM can be done one of two ways:

1) Using EasyApache: go to WHM >> EasyApache, and then select “IonCube Loaders” from the Exhaustive Options List before starting the compilation process.

2) Using phpextensionmgr script:

This way is the recommended as you don’t need to recompile Apache and PHP, it’s a lot faster:

/scripts/phpextensionmgr install IonCubeLoader

How can I uninstall ioncube loaders on cPanel?

/scripts/phpextensionmgr uninstall IonCubeLoader

How can I install ioncube loaders on servers without cPanel?

Begin by downloading the latest loaders to your computer from:  http://www.ioncube.com/loaders.php

Grab the latest files, extract and move to the new directory, example:

cd /usr/src
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
unzip ioncube_loaders_lin_x86-64.tar.gz
tar -xvpzf ioncube_loaders_lin_x86-64.tar.gz
cd ioncube

Find out your PHP modules extension dir

grep extension_dir -i /etc/php.ini

Note: on Fedora, RHEL and CentOS it’s located at /etc/php.ini, but in other Linux distro this may be different. 

In my case extension_dir was: /usr/lib64/php/modules/. So I’ve placed the ioncube_loader_lin* files inside that directory, let’s copy those:

cp ioncube_loader_lin_5.4* /usr/lib64/php/modules/ -fv

Add Iocube loaders into PHP configuration:

echo "zend_extension=/usr/lib64/php/modules/ioncube_loader_lin_5.4.so" >> /etc/php.ini

Important: replace “zend_extension=/usr/lib64/php/modules/ioncube_loader_lin_5.4.so” with the real path of your extensions dir and ioncube loaders file, that must be the same as the PHP version you are running.

Check Ioncube loaders are working

Run php -v as stated before, you should see something like this:

with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd.

That’s all, your server now should be running Ioncube Loaders without issues.

Further reading:

About the Author: Martin Keler

Leave a Reply

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