How to Install ionCube Loader on Ubuntu 16.04 | 17.10 | 18.04

If you’re developing or using any PHP applications that need to be secured, you may want to install ionCube Loader. ionCube Loader can be used to encode and secure PHP files.

It’s mostly used with commercial PHP applications to provide another layer of security in an unpredictable world of website security. On Linux systems including Ubuntu, it’s installed on the webserver (Physical) and made available to PHP configuration.

This brief tutorial shows students and new users how to download and install ionCube Loader on Ubuntu 16.04 / 17.10 and 18.04 server with PHP 7.1 / 7.2 installed.

To install this PHP tool, follow the steps below:

Step 1: Download ionCube Loader

There are other ways to install ionCube Loader, however, downloading it and installing it manually is the safest way to go.

On 64-bit systems, use the link below:

cd /tmp && wget

On 32-bit systems can use this link.

cd /tmp && wget

After downloading version for your platform, run the commands below to extract the loader.

tar xfz ioncube_loaders_lin_*.gz

After extracting list all ionCube versions.

ls ioncube

ionCube Ubuntu Install

Step 2: Validate PHP Version Installed

Before you begin using a particular version of ionCube loader, you must validate the PHP version installed on the system. then use that particular loader for the specific PHP version.

To see which version of PHP installed, run the commands below. You should see the PHP version installed on your system.

php -v

Output:

PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies

Next, find the PHP extensions directory on the system by running the commands below

php -i | grep extension_dir

Output:

extension_dir => /usr/lib/php/20170718 => /usr/lib/php/20170718

You should see the directory PHP uses for its extensions.

Next, copy the ionCube loader into the PHP directory above, by running the commands below. do this for each loader for the particular PHP version.

sudo cp /tmp/ioncube/ioncube_loader_lin_7.1.so /usr/lib/php/20170718/
sudo cp /tmp/ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20170718/

When you’re done. open the default PHP config file and include the loader.

Step 3: Use ionCube Loader with PHP

Now that you’ve downloaded, extracted and copied ionCube loader to PHP directory, open PHP configuration file and include the loader.

PHP with Nginx

sudo nano /etc/php/7.2/fpm/php.ini

PHP with Apache2

sudo nano /etc/php/7.2/apache2/php.ini

PHP with CLI

sudo nano /etc/php/7.2/cli/php.ini

PHP with CGI

sudo nano /etc/php/7.2/cgi/php.ini

Then add a line in the file to include ionCube loader. it can be anywhere in the file below [PHP] line. however, you’ll need to specify the exact location of the loader you copied above.

zend_extension = /usr/lib/php/20170718/ioncube_loader_lin_7.2.so

Save the file and restart PHP and / or the webserver.

sudo systemctl restart apache2.service
sudo systemctl restart php7.2-fpm.service

Now check PHP to see all modules installed. If you added it to the CLI config, you should see the output below when you run the php cli command.

php -v

Output:

PHP 7.2.3-1ubuntu1 (cli) (built: Mar 14 2018 22:03:58) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.0, Copyright (c) 2002-2018, by ionCube Ltd.
    with Zend OPcache v7.2.3-1ubuntu1, Copyright (c) 1999-2018, by Zend Technologies

Enjoy!

You may also like the post below: