Ioncube is a PHP module that allows you to work with coded scripts. These scripts are closed code, as a rule, these are commercial systems or modules that are paid. In these scripts, as a rule, a license validity check is used, and so that no one removes this verification code, and the source code itself is not used for commercial purposes by others, it is encoded. This PHP module performs decoding, which makes this type of script work.
For each PHP version you need to install its own version of the module.
1. Download the latest version of Ioncube
x64
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
x32
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
2. Installation
2.1 Determine the presence of php versions on the server
ls /usr/bin/ | grep php
In our case, there are 2 versions installed on the server for which we will configure Ioncube.
2.2 Define the folder where php modules are located for each version
php 7.3
/usr/bin/php7.3 -i | grep extension_dir
php 8.1
/usr/bin/php8.1 -i | grep extension_dir
2.3 Copy modules from the downloaded archive
tar -xvf ioncube_loaders_lin_x86-64.tar.gz -C /var/tmp/
cp /var/tmp/ioncube/ioncube_loader_lin_7.3.so /usr/lib/php/20180731
cp /var/tmp/ioncube/ioncube_loader_lin_7.3_ts.so /usr/lib/php/20180731
cp /var/tmp/ioncube/ioncube_loader_lin_8.1.so /usr/lib/php/20210902
cp /var/tmp/ioncube/ioncube_loader_lin_8.1_ts.so /usr/lib/php/20210902
2.4 Add modules to the configuration file
2.4.1 To run scripts from the console (for cron tasks)
vim /etc/php/7.3/cli/php.ini
[Zend]
zend_extension=/usr/lib/php/20180731/ioncube_loader_lin_7.3.so
zend_extension_ts = /usr/lib/php/20180731/ioncube_loader_lin_7.3_ts.so
vim /etc/php/8.1/cli/php.ini
[Zend]
zend_extension=/usr/lib/php/20210902/ioncube_loader_lin_8.1.so
zend_extension_ts = /usr/lib/php/20210902/ioncube_loader_lin_8.1_ts.so
2.4.2 For the web service, in our example we use fpm
vim /etc/php/7.3/fpm/php.ini
[Zend]
zend_extension=/usr/lib/php/20180731/ioncube_loader_lin_7.3.so
zend_extension_ts = /usr/lib/php/20180731/ioncube_loader_lin_7.3_ts.so
vim /etc/php/8.1/fpm/php.ini
[Zend]
zend_extension=/usr/lib/php/20210902/ioncube_loader_lin_8.1.so
zend_extension_ts = /usr/lib/php/20210902/ioncube_loader_lin_8.1_ts.so
If you are using apache, add the same lines.
2.5 Save and apply the settings
To save changes to configuration files, use the command
:wq
Let's restart the web services
service php7.3-fpm restart
service php8.1-fpm restart
3. Check
php 7.3
/usr/bin/php7.3 -v
php 8.1
/usr/bin/php8.1 -v
Done, now the encoded scripts will work correctly on your server.