While InterWorx automatically installs many PHP modules via RPMs, there aren't any available for ionCube's PHP loaders.
Installing ionCube on an InterWorx Server with MultiPHP
By default, InterWorx servers utilize the system installed version of PHP, which in CentOS or RHEL 7 happens to be PHP 5.4, but most admins end up enabling multiple versions of PHP. These directions will assume that you have all currently available versions of PHP installed. This includes:
PHP 5.4 (the system installed version)
PHP 5.4, 5.5, 5.6, 7.0, 7.1, 7.2 (these are installed from the remi-safe RPM repository)
If you only have some or only one of these installed, then only follow the directions for the version(s) of PHP that you use.
Installing the ionCube loaders follow the same basic process regardless of the version of PHP you are installing it in, but the exact locations vary depending on the PHP version itself.
Download and Decompress the Latest ionCube Loaders
HostDime only sells 64-bit servers, so although ionCube is available in 32-bit and 64-bit versions, these directions will only cover the 64-bit version.
Download the appropriate version of the loaders:
Download for 64-bit Loaderscd; wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
Now decompress the loaders you just downloaded:
Decompress the 64-Bit Versiontar xfz ioncube_loaders_lin_x86-64.tar.gz
Enter the ioncube loader directory you just decompressed and change the permissions of the .so files to 755 and for safety, change the ownership to root:
cd ioncube chmod 755 *.so chown root: *.so
Copy the Loaders to the Appropriate PHP Module Directory
Now you need to copy the loader(s) into the proper location for each version of PHP you have installed.
These commands assume you're already in the ioncube directory.
cp -p ioncube_loader_lin_5.4.so /usr/lib64/php/modules/
cp -p ioncube_loader_lin_5.4.so /opt/remi/php54/root/usr/lib64/php/modules/
cp -p ioncube_loader_lin_5.5.so /opt/remi/php55/root/usr/lib64/php/modules/
cp -p ioncube_loader_lin_5.6.so /opt/remi/php56/root/usr/lib64/php/modules/
cp -p ioncube_loader_lin_7.0.so /opt/remi/php70/root/usr/lib64/php/modules/
cp -p ioncube_loader_lin_7.1.so /opt/remi/php71/root/usr/lib64/php/modules/
cp -p ioncube_loader_lin_7.2.so /opt/remi/php72/root/usr/lib64/php/modules/
cp -p ioncube_loader_lin_7.3.so /opt/remi/php73/root/usr/lib64/php/modules/
Add the ionCube Configuration to PHP
Now that you've put the loader in place, we need to tell PHP that it is there so that PHP can load the module.
Only follow the directions for versions of PHP that you have installed.
echo "zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_5.4.so" > /etc/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php54/root/usr/lib64/php/modules/ioncube_loader_lin_5.4.so" > /opt/remi/php54/root/etc/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php55/root/usr/lib64/php/modules/ioncube_loader_lin_5.5.so" > /opt/remi/php55/root/etc/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php56/root/usr/lib64/php/modules/ioncube_loader_lin_5.6.so" > /etc/opt/remi/php56/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php70/root/usr/lib64/php/modules/ioncube_loader_lin_7.0.so" > /etc/opt/remi/php70/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php71/root/usr/lib64/php/modules/ioncube_loader_lin_7.1.so" > /etc/opt/remi/php71/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php72/root/usr/lib64/php/modules/ioncube_loader_lin_7.2.so" > /etc/opt/remi/php72/php.d/00-ioncube.ini
echo "zend_extension = /opt/remi/php73/root/usr/lib64/php/modules/ioncube_loader_lin_7.3.so" > /etc/opt/remi/php73/php.d/00-ioncube.ini
Restart Apache and PHP-FPM
Now that everything is ready, you need to restart Apache and PHP-FPM if you are using it. This will cause the system to actively start using ionCube.
You have two ways you can restart Apache or PHP-FPM, you can run a command via the command line if you're running as the root user OR you can restart these things from NodeWorx.
Restart Apache and PHP-FPM via Command Line
Since you are already logged into the command line as root, it's probably easiest to restart Apache and PHP this way. Select the appropriate commands from the list below.
systemctl restart httpd
systemctl restart php-fpm systemctl restart php54-php-fpm systemctl restart php55-php-fpm systemctl restart php56-php-fpm systemctl restart php70-php-fpm systemctl restart php71-php-fpm systemctl restart php72-php-fpm systemctl restart php73-php-fpm
Now you can check each PHP version to see if it is loading the ionCube loaders properly.
php -i | grep ioncube /opt/remi/php54/root/bin/php -i | grep ioncube /opt/remi/php55/root/bin/php -i | grep ioncube /opt/remi/php56/root/bin/php -i | grep ioncube /opt/remi/php70/root/bin/php -i | grep ioncube /opt/remi/php71/root/bin/php -i | grep ioncube /opt/remi/php72/root/bin/php -i | grep ioncube /opt/remi/php73/root/bin/php -i | grep ioncube
The output from these various commands should look something like this if ionCube is working. If nothing is output, review the changes you made and ensure that they were made correctly for versions of PHP that you actually have installed.
# /opt/remi/php73/root/bin/php -i | grep ioncube Additional .ini files parsed => /etc/opt/remi/php73/php.d/00-ioncube.ini, For Loader updates visit www.ioncube.com/loaders.php For support visit support.ioncube.com This Loader also includes features for real-time error reporting and malware protection. Visit ioncube24.com for more details. ioncube.loader.encoded_paths => no value => no value
Restart Apache and PHP-FPM via NodeWorx
If you'd like to use the NodeWorx GUI to restart Apache and PHP-FPM, you can follow these steps:
- Log into NodeWorx as the primary admin user. Example: https://your.server.com:2443/
- In the System Services section, select Web Server.
- Restart Apache by clicking the small circular icon in between the start and stop icons.
- If you are using PHP-FPM, click the Restart button in the Restart PHP-FRPM section below the Web Server Control section.
- If everything restarted properly, you can check the system installed version of PHP to see if ioncube is enabled. Click on the PHP Info button in the PHP Information section.
- Scroll down and check for mentions of ionCube. If you see some and it shows as enabled, then you know you did things correctly. To check the other versions of PHP that you have installed, follow the command line directions above since InterWorx does not include a way to check the PHP info of other installed versions of PHP.
Congratulations, you've successfully enabled ionCube in all versions of PHP.