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
root@server:/# 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
root@server:/# cd /tmp && wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
Extract the ionCube Loader files
root@server:/tmp# tar xfz ioncube_loaders_lin_*.gz
View all available ionCube PHP extension
root@server:/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
root@server:/# php -v
Output should be something like this:
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:
root@server:/# update-alternatives --config 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:
root@server:/# /usr/bin/php5.6 -i | grep extension_dir
If you are using PHP 5.6, then the output should be something like this:
If you are using PHP 7.2, then the output should be something like this:
If you are using PHP 7.3, then the output should be something like this:
Copy the ionCube loader into the extensions directory
If you are using PHP 5.6, enter this:
root@server:/# cp /tmp/ioncube/ioncube_loader_lin_5.6.so /usr/lib/php/20131226/
If you are using PHP 7.2, enter this:
root@server:/# cp /tmp/ioncube/ioncube_loader_lin_7.2.so /usr/lib/php/20170718/
If you are using PHP 7.3, enter this:
root@server:/# 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
root@server:/# nano /etc/php/5.6/fpm/php.ini
root@server:/# nano /etc/php/5.6/cli/php.ini
PHP 7.2
root@server:/# nano /etc/php/7.2/apache2/php.ini
root@server:/# nano /etc/php/7.2/fpm/php.ini
root@server:/# nano /etc/php/7.2/cli/php.ini
PHP 7.3
root@server:/# nano /etc/php/7.3/apache2/php.ini
root@server:/# nano /etc/php/7.3/fpm/php.ini
root@server:/# nano /etc/php/7.3/cli/php.ini
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:
root@server:/# service apache2 restart
root@server:/# service php7.3-fpm restart
Check PHP to see all modules installed., if you added the iconCube loader to PHP-CLI:
root@server:/# php -v
Output:
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".
3010