08th Jul2019
Author: Gyro

How To Install IonCube Loader On Ubuntu running PHP 5.6 | PHP 7.2 | PHP 7.3

I just wanted to install Softaculous in ISPConfig on a server running Ubuntu 18.04, but stumbled upon the requirement of the ionCube Loader.

The ionCube Loader is used by some PHP applications in an effort to secure their PHP code. I personally find it quite silly, as there are ALWAYS ways to decode something, and files secured though ionCube are no exception to that rule. People who think security though obscurity is still a thing have clearly missed the ball imho.

Anyways… here is my take on how to install ionCube Loader on Ubuntu 16.04, 17.10 or 18.04 servers that run PHP 5.6, PHP 7.2, and/or PHP 7.3.

Step 1: Download ionCube Loader

Please let me know in a comment, if these links stop working. Thanks!

On 64-bit systems, enter this in your console

[email protected]:/# cd /tmp && wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

On 32-bit systems, enter this in your console

[email protected]:/# cd /tmp && wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

Extract the ionCube Loader files

[email protected]:/tmp# tar xfz ioncube_loaders_lin_*.gz

View all available ionCube PHP extension

[email protected]:/tmp# ls ioncube

Step 2: Check te PHP Version(s) and locate the extensions directory

In order to use ionCube Loader, you must add it to the PHP versions you are using.

A good start is to see what version is used by the cli

[email protected]:/# php -v

Output should be something like this:

PHP 7.3.6-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:06:48) ( NTS )

Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.6-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Get the location of the extensions directory

You may have more than one PHP version installed. An easy way to check which PHP versions are available, you can enter:

[email protected]:/# update-alternatives --config php

There are 3 choices for the alternative php (providing /usr/bin/php).

Selection Path Priority Status
————————————————————
* 0 /usr/bin/php7.3 73 auto mode
1 /usr/bin/php5.6 56 manual mode
2 /usr/bin/php7.2 72 manual mode
3 /usr/bin/php7.3 73 manual mode

Press <enter> to keep the current choice[*], or type selection number:

So, to get the extension directory of the PHP version that needs the ionCube loader extension, you enter something like this:

[email protected]:/# /usr/bin/php5.6 -i | grep extension_dir

If you are using PHP 5.6, then the output should be something like this:

extension_dir => /usr/lib/php/20131226 => /usr/lib/php/20131226

If you are using PHP 7.2, then the output should be something like this:

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

If you are using PHP 7.3, then the output should be something like this:

extension_dir => /usr/lib/php/20180731 => /usr/lib/php/20180731

Copy the ionCube loader into the extensions directory

If you are using PHP 5.6, enter this:

[email protected]:/# cp /tmp/ioncube/ioncube_loader_lin_5.6.so /usr/lib/php/20131226/

If you are using PHP 7.2, enter this:

[email protected]:/# cp /tmp/ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20170718/

If you are using PHP 7.3, enter this:

[email protected]:/# cp /tmp/ioncube/ioncube_loader_lin_7.3.so /usr/lib/php/20180731/

Step 3: Add ionCube Loader to PHP

Now that you’ve downloaded, extracted and copied ionCube loader to PHP directory, To enable the ionCube loader extension, you have to add a line to the respective php.ini file(s). Here are the default locations of all php.ini files on a Ubuntu system running PHP 5.6, PHP 7.2, and PHP 7.3:

PHP 5.6

[email protected]:/# nano /etc/php/5.6/fpm/php.ini

zend_extension = /usr/lib/php/20131226/ioncube_loader_lin_5.6.so

[email protected]:/# nano /etc/php/5.6/cli/php.ini

zend_extension = /usr/lib/php/20131226/ioncube_loader_lin_5.6.so

PHP 7.2

[email protected]:/# nano /etc/php/7.2/apache2/php.ini

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

[email protected]:/# nano /etc/php/7.2/fpm/php.ini

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

[email protected]:/# nano /etc/php/7.2/cli/php.ini

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

PHP 7.3

[email protected]:/# nano /etc/php/7.3/apache2/php.ini

zend_extension = /usr/lib/php/20180731/ioncube_loader_lin_7.3.so

[email protected]:/# nano /etc/php/7.3/fpm/php.ini

zend_extension = /usr/lib/php/20180731/ioncube_loader_lin_7.3.so

[email protected]:/# nano /etc/php/7.3/cli/php.ini

zend_extension = /usr/lib/php/20180731/ioncube_loader_lin_7.3.so

Step 4: Restart and Verify

Once you have added the above line(s) to the respective php.ini file(s), you also have to restart the related service(s) (php7.2-fpm, php-7.3-fpm, apache2, nginx). For example:

[email protected]:/# service  apache2 restart
[email protected]:/# service php7.3-fpm restart

Check PHP to see all modules installed., if you added the iconCube loader to PHP-CLI:

[email protected]:/# php -v

Output:

PHP 7.3.6-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May 31 2019 11:06:48) ( NTS )

Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
with the ionCube PHP Loader + ionCube24 v10.3.7, Copyright (c) 2002-2019, by ionCube Ltd.
with Zend OPcache v7.3.6-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Final Note

After having installed and configured the IonCube loader extension for all PHP version on the server, I came to the sad conclusion that I did it all for nothing. Why you ask? Well, when you follow the instructions as given in the link I posted earlier, Softaculous will actually get installed including the required IonCube loader extension! The reason I experienced issues with Softaculous after installing (blank page) had absolutely nothing to do with the IonCube loader extension. But, I guess the conclusion of this story will have to appear in a post of its own, which will probably be named something like "How to RTFM when installing Softaculous for ISPConfig".

139

Keep Me Going
Your Name / Website:
Did you like my post? Buy me a Bitcoffee! 14JX52Li7zTKbyQv2omw4tvu6Bi1KzfHNW



Leave a Reply

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

What is 7 + 15 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)