How to install ionCube loader

IonCube loader can be a bit tricky to install and getting to work correctly. That is why we will show you how to install it on Ubuntu 18.04 with PHP 7.2.

IonCube is a piece of software that encodes the source of PHP files. If you try to open these files in a text editor you will only see gibberish.

Now we have a piece of software which encodes our files and makes them useless for others. This leaves one question, how does my site understand it?

This is where ionCube loader comes into play. The loader is what loads these encoded files and translates them back to understandable text for your website.

A good example of when ionCube might come into play is when you are using third-party modules for Magento 2. Some of these modules require you to use ionCube to make the modules work. For more about Magento 2, check out our How to install Magento 2 on Ubuntu 18.04 / Windows 10 article.

Now that we have the information bit out of the way, let us get started with downloading ionCube loader.

Command-line interface (CLI)

This article is written for PHP 7.2 but can be used for higher and lower versions aswell. Replace the version numbers with the one you are using to proceed.

$ wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

We downloaded the compressed archive from the ionCube download page.

Next, let us extract the archive

$ tar -xvzf ioncube_loaders_lin_x86-64.tar.gz
$ cd ioncube

Since ionCube requires us to copy a shared object file (.so) to our PHP folder we need to find out where this folder is

$ php -i | grep extension_dir
extension_dir => /usr/lib/php/20170718 => /usr/lib/php/20170718

Next, we can copy the .so file to our PHP folder

$ sudo cp ioncube_loader_lin_7.2.so /usr/lib/php/20170718

Before we will restart the php7.2-fpm service we need to enable the ionCube extension in a configuration file.

$ php -i | grep additional
Scan this dir for additional .ini files => /etc/php/7.2/cli/conf.d

In this folder we can create the required .ini file.

# for php-fpm
$ echo 'zend_extension=ioncube_loader_lin_7.2.so' > /etc/php/7.2/fpm/conf.d/00-ioncube-loader.ini
# for php-cli to avoid errors with cronjob
$ echo 'zend_extension=ioncube_loader_lin_7.2.so' > /etc/php/7.2/cli/conf.d/00-ioncube-loader.ini

Finally, we can restart the php7.2-fpm service

$ service php7.2-fpm restart

To check if everything went well we can check our PHP version info

$ php -v
PHP 7.2.17-0ubuntu0.18.04.1 (cli) (built: Apr 18 2019 14:12:38) ( 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.3.4, Copyright (c) 2002-2019, by ionCube Ltd.
    with Zend OPcache v7.2.17-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies

Apache 2

In order to get ionCube working for Apache we need to download their wizard script.

$ wget https://www.ioncube.com/loader-wizard/loader-wizard.tgz
$ tar -xvzf loader-wizard.tgz
$ cd loader-wizard.tgz

Now that we have downloaded and extracted the wizard archive, we can move the loader-wizard-php file to the webroot

$ mv loader-wizard.php /var/www/html

Next, we can add our ionCube extension to the Apache configuration

$ echo 'zend_extension=ioncube_loader_lin_7.2.so' > /etc/php/7.2/apache2/conf.d/00-ioncube-loader.ini

Restart the Apache service to load in the new zend_extension line

$ sudo service apache2 restart

Finally we can visit our website at http://127.0.0.1/loader-wizard.php and see if ionCube has been successfully installed.

Leave a Reply

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