If you’re looking to encrypt PHP code in your application – ionCube is a great choice.
Using ionCube allows you to pass your PHP source code through their PHP encoder before an application is distributed which protects the code from being human-readable.
By default, PHP code that is encrypted/encoded in this way cannot be executed directly on your server – this is where ionCube loader comes in, to ensure that the PHP engine is able to process and run your code.
So – without further ado – let’s dive right in:
What is ionCube Loader
The ionCube loader is a PHP module that can be used to load encrypted PHP files. This allows you to protect your scripts from theft and change by others. The loader is supplied as a PHP extension module for Windows, Linux, and macOS which can be installed into a PHP installation and is freely redistributable.
The ionCube PHP Loader is a proprietary, yet open-source encoding for PHP scripts. It has been developed by ionCube and is available as both a freeware and commercial product. The loader encodes the PHP script so that it can only be executed in combination with an IonCube encoded file containing a decryption key. The loader makes it possible to easily protect your website’s PHP scripts from casual observation, theft, or change by others.
Installing ionCube Loader
Before you begin installing the ionCube Loader you’ll need to know which PHP version your website is running on. At RunCloud, we offer multiple versions of PHP, from 7.0 right up to the latest 8.1 release. If you’re not sure which PHP version your website is on, log in to your dashboard, and head over to ‘Settings’ on the left:

So, as an example, if you find that your website is currently running PHP version 7.4, then you’ll need to make sure you install the 7.4 version of ionCube. We’ve provided all of the code you’ll need for every version of PHP.
Once you’ve determined the PHP version you need, log in to your web server as root, and run the appropriate command below to download the right version of ionCloud, and extract it:
Download & Extract
cd
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -zxvf ioncube_loaders_lin_x86-64.tar.gz
Once you’ve done this, you’re ready to install the ionCube Loader, so choose the correct PHP version code from below, and run it on your server:
PHP7.0
cp ioncube/ioncube_loader_lin_7.0.so /RunCloud/Packages/php70rc/lib/php/extensions/no-debug-non-zts-20151012/
echo "zend_extension=ioncube_loader_lin_7.0.so" > /etc/php70rc/conf.d/ioncube.ini
systemctl restart php70rc-fpm
PHP7.1
cp ioncube/ioncube_loader_lin_7.1.so /RunCloud/Packages/php71rc/lib/php/extensions/no-debug-non-zts-20160303/
echo "zend_extension=ioncube_loader_lin_7.1.so" > /etc/php71rc/conf.d/ioncube.ini
systemctl restart php71rc-fpm
PHP7.2
cp ioncube/ioncube_loader_lin_7.2.so /RunCloud/Packages/php72rc/lib/php/extensions/no-debug-non-zts-20170718/
echo "zend_extension=ioncube_loader_lin_7.2.so" > /etc/php72rc/conf.d/ioncube.ini
systemctl restart php72rc-fpm
PHP7.3
cp ioncube/ioncube_loader_lin_7.3.so /RunCloud/Packages/php73rc/lib/php/extensions/no-debug-non-zts-20180731/
echo "zend_extension=ioncube_loader_lin_7.3.so" > /etc/php73rc/conf.d/ioncube.ini
systemctl restart php73rc-fpm
PHP7.4
cp ioncube/ioncube_loader_lin_7.4.so /RunCloud/Packages/php74rc/lib/php/extensions/no-debug-non-zts-20190902/
echo "zend_extension=ioncube_loader_lin_7.4.so" > /etc/php74rc/conf.d/ioncube.ini
systemctl restart php74rc-fpm
PHP8.0
cp ioncube/ioncube_loader_lin_8.0.so /RunCloud/Packages/php80rc/lib/php/extensions/no-debug-non-zts-20200930
echo "zend_extension=ioncube_loader_lin_8.0.so" > /etc/php80rc/conf.d/ioncube.ini
systemctl restart php80rc-fpm
PHP8.1
cp ioncube/ioncube_loader_lin_8.1.so /RunCloud/Packages/php81rc/lib/php/extensions/no-debug-non-zts-20210902
echo "zend_extension=ioncube_loader_lin_8.1.so" > /etc/php81rc/conf.d/ioncube.ini
systemctl restart php81rc-fpm
Checking ionCube Installation
Once you’ve installed ionCube you may want to verify that it’s installed properly and that everything is running correctly. To do this you simply need to enter one line of code, which will vary depending on your PHP version, as shown below:
PHP7.0
/RunCloud/Packages/php70rc/bin/php -m | grep -i ioncube
PHP7.1
/RunCloud/Packages/php71rc/bin/php -m | grep -i ioncube
PHP7.2
/RunCloud/Packages/php72rc/bin/php -m | grep -i ioncube
PHP7.3
/RunCloud/Packages/php73rc/bin/php -m | grep -i ioncube
PHP7.4
/RunCloud/Packages/php74rc/bin/php -m | grep -i ioncube
PHP8.0
/RunCloud/Packages/php80rc/bin/php -m | grep -i ioncube
PHP8.1
/RunCloud/Packages/php81rc/bin/php -m | grep -i ioncube
If your installation is success, you will see the output as follows:
ionCube Loader
the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured)
Removing ionCube Loader
Should you no longer need the ionCube facility, it can be removed very easily. Just as with installing it, you’ll need to know the PHP version you’re running on.
When you remove the ionCube loader, this will also remove the .so library. We’ve included the code you need to run below, depending on your PHP version.
PHP7.0
rm ioncube/ioncube_loader_lin_7.0.so /RunCloud/Packages/php70rc/lib/php/extensions/no-debug-non-zts-20151012/
PHP7.1
rm ioncube/ioncube_loader_lin_7.1.so /RunCloud/Packages/php71rc/lib/php/extensions/no-debug-non-zts-20160303/
PHP7.2
rm ioncube/ioncube_loader_lin_7.2.so /RunCloud/Packages/php72rc/lib/php/extensions/no-debug-non-zts-20170718/
PHP7.3
rm ioncube/ioncube_loader_lin_7.3.so /RunCloud/Packages/php73rc/lib/php/extensions/no-debug-non-zts-20180731/
PHP7.4
rm ioncube/ioncube_loader_lin_7.4.so /RunCloud/Packages/php74rc/lib/php/extensions/no-debug-non-zts-20190902/
PHP8.0
rm ioncube/ioncube_loader_lin_8.0.so /RunCloud/Packages/php80rc/lib/php/extensions/no-debug-non-zts-20200930
PHP8.1
rm ioncube/ioncube_loader_lin_8.1.so /RunCloud/Packages/php81rc/lib/php/extensions/no-debug-non-zts-20210902
Updating Your PHP Version
From time to time, you will almost certainly want to update the PHP version you are running, so how does this affect the version of ionCube you have installed?
Fortunately, it’s actually very straightforward, since ionCube has its own separate directory for each version of PHP it’s installed for. This means that, for example, if you had PHP 7.1, and installed the appropriate version of ionCube for that, but then upgraded to PHP 8.0, all you would need to do is to install the version of ionCube for that particular version of PHP.
It would be good practice though to remove the unused version of ionCube, but having two versions wouldn’t directly cause any issues.
Just remember to install a new version of ionCube each time you upgrade the PHP version your site is using.
To install and remove ionCube versions, just follow the steps detailed above.
Backwards Compatilibility And Limitations
If you’re upgrading your version of PHP, it may not always be necessary to remove ionCube and install a newer version.
Encoded files can, in general, run on versions of PHP equal to or greater than the source language of the Encoder used to produce them. So a file produced by the Encoder for PHP 7.2 can be run by the Loaders for PHP 7.2, 7.3, and 7.4, but not 7.1. This means that the Loaders offer good backwards compatibility, however there are the following limitations:
- The Loader for PHP 8.1 can only run files produced by the version 12 Encoder for PHP 8.1.
- The Loaders for PHP 7.1 through 7.4 can only run files produced by the Encoders for PHP 7.
- The Loader for PHP 7.0 can only run files produced by the Encoder for PHP 5.6.
- The Loaders for PHP 5.5 and PHP 5.6 cannot run files produced by the PHP 4 Encoder.
Conclusion
ionCube’s tools are hugely valuable in both protecting and optimizing your PHP code. By encrypting and obfuscating your code you are guarding your code from prying eyes, protecting your intellectual property from being used without permission, or in any way you don’t approve of.
By using the ionCube tools your PHP code will no longer be able to be reverse engineered, copied or stolen, but as well as this it will also help speed up your code. It achieves this by compressing them before sending them back to the clients requesting that particular resource. This compression results in faster load times for end users who are trying to view or interact with your application from their browser, making for more enjoyable user experiences overall.
Categories: Tutorials, Tips & Tricks
Great article! Keep riching resources for your lovely product. RunCloud rocks!
Thank you!
Does IonCube support PHP7 yet?
I mean to say 7.1 *
Seems like they did. You can read the loader changes inside https://www.ioncube.com/loaders.php
IonCube supports 7.1 & 7.2. Run the following as root to install it:
7.1
cp ioncube/ioncube_loader_lin_7.1.so /RunCloud/Packages/php71rc/lib/php/extensions/no-debug-non-zts-20160303/
echo “zend_extension=ioncube_loader_lin_7.1.so” > /etc/php71rc/conf.d/ioncube.ini
systemctl restart php71rc-fpm
7.2
cp ioncube/ioncube_loader_lin_7.2.so /RunCloud/Packages/php72rc/lib/php/extensions/no-debug-non-zts-20170718/
echo “zend_extension=ioncube_loader_lin_7.2.so” > /etc/php72rc/conf.d/ioncube.ini
systemctl restart php72rc-fpm
Hey, the code doesn’t working for me.
Checked with this command:
/RunCloud/Packages/php71rc/bin/php -m | grep -i ioncube
And nothing happen.
Can you guys update this settings for a php 7.2 I see is ionCube available, tnx.
Can you please try this
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -zxvf ioncube_loaders_lin_x86-64.tar.gz
cp ioncube/ioncube_loader_lin_7.2.so /RunCloud/Packages/php72rc/lib/php/extensions/no-debug-non-zts-20170718/
echo “zend_extension=ioncube_loader_lin_7.2.so” > /etc/php72rc/conf.d/ioncube.ini
systemctl restart php72rc-fpm
/RunCloud/Packages/php72rc/bin/php -m | grep -i ioncube
@Makis Thank you ….[Makis code has small mistake ] @Larry replace [ “ ] to [ ” ]
This should be updated to include 7.1, 7.2 and 7.3 :
cp ioncube/ioncube_loader_lin_7.0.so /RunCloud/Packages/php70rc/lib/php/extensions/no-debug-non-zts-20151012/
echo “zend_extension=ioncube_loader_lin_7.0.so” > /etc/php70rc/conf.d/ioncube.ini
systemctl restart php70rc-fpm
cp ioncube/ioncube_loader_lin_7.1.so /RunCloud/Packages/php71rc/lib/php/extensions/no-debug-non-zts-20160303/
echo “zend_extension=ioncube_loader_lin_7.1.so” > /etc/php71rc/conf.d/ioncube.ini
systemctl restart php71rc-fpm
cp ioncube/ioncube_loader_lin_7.2.so /RunCloud/Packages/php72rc/lib/php/extensions/no-debug-non-zts-20170718/
echo “zend_extension=ioncube_loader_lin_7.2.so” > /etc/php72rc/conf.d/ioncube.ini
systemctl restart php72rc-fpm
cp ioncube/ioncube_loader_lin_7.3.so /RunCloud/Packages/php73rc/lib/php/extensions/no-debug-non-zts-20180731/
echo “zend_extension=ioncube_loader_lin_7.3.so” > /etc/php73rc/conf.d/ioncube.ini
systemctl restart php73rc-fpm
Thank you very much for updating this post to support IonCube Loader for PHP 7.1, 7.2, 7.3 😉
Hi there,
How to install it on PHP 7.4. I’m not a programmer and I can’t find the instruction anywhere.
I only found tar.gz file here: https://www.ioncube.com/loaders.php
Can someone help me?
Hey Fajar, take a look at this link from the RunCloud knowledgebase: https://runcloud.io/knowledgebase/articles/web-application/how-to-change-php-version-on-web-app