How to install Ioncube loader on CentOS, Debian and Ubuntu Back

How to install Ioncube loader on CentOS, Debian and Ubuntu

Introduction

Using ionCube encoded and secured PHP files requires a file called the ionCube Loader to be installed on the web server and made available to PHP. PHP can use the Loader with one line added to a PHP configuration file (php.ini). This article will explain the procedure to install ioncube loader into CentOS, Ubuntu and Debian in detail.

Step 1: Download ioncube loader

The first step in installing the ioncube loader is obviously to download the installation files from inocube’s website. But before doing so please check whether your system is running on 32bit or 64bit architecture, because the download file for each architecture is different. You can check this by running the following command in your terminal,

# uname -a

Sample output:

Linux  Ubuntu-4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

In this output it is clearly mentioned as the system is running on 64bit architecture.

Then according to your architecture type download the required files into /tmp directory in your system.

For 64bit system:

# cd /tmp
# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Then unzip the downloaded files using the tar command

# tar xfz ioncube_loaders_lin_x86-64.tar.gz

For 32bit system:

# cd /tmp
# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
# tar xfz ioncube_loaders_lin_x86.tar.gz

By default the files will be unzipped to a folder “ioncube”

Step 2: Select the right ioncube loader to install

There will be various ioncube loader files unzipped into the ioncube folder corresponding to various php versions. You need to select the correct ioncube loader file asper the php version installed on your server. To know the version of php installed on your server, run the command,

# php -v

Sample output:

PHP 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )
 Copyright (c) 1997-2016 The PHP Group
 Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
 with Zend OPcache v7.0.13-0ubuntu0.16.04.1, Copyright (c) 1999-2016, by Zend Technologies

In our case, the php version installed is PHP 7.0.13 which may vary from server to server. Check your version and then run the command ls /tmp/ioncube to check all the available ioncube loader files.

# ls /tmp/ioncube

Output:

 ioncube_loader_lin_4.1.so               ioncube_loader_lin_5.4.so
 ioncube_loader_lin_4.2.so              ioncube_loader_lin_5.4_ts.so
 ioncube_loader_lin_4.3.so              ioncube_loader_lin_5.5.so
 ioncube_loader_lin_4.3_ts.so           ioncube_loader_lin_5.5_ts.so
 ioncube_loader_lin_4.4.so              ioncube_loader_lin_5.6.so
 ioncube_loader_lin_4.4_ts.so           ioncube_loader_lin_5.6_ts.so
 ioncube_loader_lin_5.0.so              ioncube_loader_lin_7.0.so
 ioncube_loader_lin_5.0_ts.so           ioncube_loader_lin_7.0_ts.so
 ioncube_loader_lin_5.1.so              LICENSE.txt
 ioncube_loader_lin_5.1_ts.so           loader-wizard.php
 ioncube_loader_lin_5.2.so              README.txt
 ioncube_loader_lin_5.2_ts.so           USER-GUIDE.pdf
 ioncube_loader_lin_5.3.so              USER-GUIDE.txt
 ioncube_loader_lin_5.3_ts.so

These are the files that were unzipped from the downloaded zip file. Now we need to find the extension directory for the PHP version running in our server. To do this run the following command,

# php -i | grep extension_dir

Output:

extension_dir => /usr/lib/php/20151012 => /usr/lib/php/20151012

The extension directory on this server is marked in red in the above result which may vary from server to server. Next we need to copy ioncube loader for our PHP version 7.0 to the extension directory.

# sudo cp /tmp/ioncube/ioncube_loader_lin_7.0.so /usr/lib/php/20151012/

Replace the PHP version and extension directory in the above command line as per your system configuration.

Step 3: Configure PHP for ioncube loader

Upto this point the process for CentOS, Debian and Ubuntu were all the same. But this configuration step is different for CentOS and Ubuntu/Debian. We have to add the following line into the top of the php.ini file(s) of the respective Linux distros.

zend_extension = /usr/lib/php/20151012/ioncube_loader_lin_7.0.so

Again please make sure that you replace the path mentioned above as per your extension directory and php version.

For CentOS:

Since centos has only one php.ini file, we shall add the given line using vim editor,

# vim /etc/php.ini

And then add the below line into the top of the php.ini file

zend_extension = /usr/lib/php/20151012/ioncube_loader_lin_7.0.so

Then save and exit the file. Now we need to restart the apache web server for the ioncube configuration to come into effect.

# service httpd restart
# service php-fpm restart

For Ubuntu/Debian:

In Ubuntu/Debian, there are separate php.ini files for PHP CLI, CGI, Apache2 and FPM mode. The path for the files may vary for different versions of PHP. In case of PHP 7.0 the path are as follows.

/etc/php/7.0/cli/php.ini
/etc/php/7.0/apache2/php.ini
/etc/php/7.0/fpm/php.ini
/etc/php/7.0/cgi/php.ini

You need to add the given line into php.ini file of the PHP module that you use. You can skip any of the above php modules that you dont use.

Enter the respective php.ini file in editing mode and add the mentioned line on top of the file.

zend_extension = /usr/lib/php/20151012/ioncube_loader_lin_7.0.so

Save and exit the php.ini file and restart the apache web server for the changes to come into effect.

# service apache2 restart
# service php-fpm restart

Step 4: Test ioncube loader

You can verify the installation of the ioncube loader by checking the php version.

# php -v

Output:

PHP 7.0.13-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v6.0.9, Copyright (c) 2002-2016, by ionCube Ltd.
    with Zend OPcache v7.0.13-0ubuntu0.16.04.1, Copyright (c) 1999-2016, by Zend Technologies

The output verifies that the PHP is now loaded with ioncube loader.

Copyright © 2021 Host Miditech LLP, All rights reserved. Privacy Policy