Did you know that a large number of PHP applications are encoded with ionCube?

If you want to use any of these applications on your web server, you need to install ionCube Loader – a PHP extension that allows you to run ionCube-encoded PHP files. But how do you install ionCube Loader on your web server? Is it easy or complicated? Do you need any technical skills or experience?

In this article, we will show you how to install ionCube Loader in less than 10 minutes with our step-by-step tutorial. You will learn:

• How to download the right Loader package
• How to extract and copy the Loader file
• How to edit the php.ini file
• How to restart your web server.

By the end of this article, you will be able to run any ionCube-encoded PHP application on your web server without any hassle. Sounds good? Then let’s get started.

What is ionCube Loader?

The ionCube Loader is a PHP extension that allows you to run ionCube-encoded PHP files on your web server. ionCube-encoded PHP files are files that have been protected with the ionCube PHP Encoder – a widely used tool that allows developers to encrypt their PHP code and add security features such as license management, malware protection, and code optimization.

The loader is supplied as a PHP extension module for Windows, Linux, and macOS, and can be installed into a PHP installation. It is also freely redistributable. By installing ionCube Loader on your web server, you can benefit from the following advantages:

  • You can use third-party PHP applications that are encoded with ionCube, such as WordPress plugins, e-commerce platforms, or CMS systems.
  • You can protect your own PHP code from being stolen, modified, or reverse engineered by encoding it with ionCube PHP Encoder and running it with ionCube Loader.
  • You can improve the performance and reliability of your PHP code by using the ionCube PHP Encoder’s features such as code compression, error reporting, and vulnerability protection.

If you are using PHP 7.4 on the OpenLiteSpeed server, ioncube Loader should be enabled by default. You can check it using the instructions provided at the end of this article. If it is not installed, you can quickly install it by running apt install lsphp74-ioncube for PHP 7.4 and apt install lsphp81-ioncube for PHP 8.1.

You should note that ionCube does not support PHP 8.0 and ionCube Loader for PHP 8.2 is still in beta development. Since PHP 7 has reached the end of life, we will only cover the instructions to install the ionCube loader for PHP 8.1.

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.2 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:

installing ioncube loader

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.

On Containerized Servers

If you are running a Containerized server on RunCloud, you can quickly install ionCube Loader with a few clicks. Go to the “Services” tab of your server and scroll down to the PHP images. Here you can see the PHP images that are available for your server.

You need to install ionCube Loader on each PHP version separately. If an image is already “in use”, click on the “” next to it and select “Change Environment Variables“. If the image is not being used on your server, you can click on “Add to stack“.

This will open a pop-up window on your screen. Under the third party extensions menu, make sure to Check the box next to ionCube.

Next, click on “Update Environment Variables” or “Add to Stack“, depending upon your setup.

You need to perform the above step for each PHP version that needs ionCube Loader.

After making the necessary changes, scroll back to the top of the services page and click on “Deploy” to save the changes. This will create new container images on your server, and all the existing (as well as new) applications on your server will be able to use the ionCube Loader.

On OpenLiteSpeed Servers

If you are using OpenLiteSpeed servers, you will need to log in to your server via SSH. After logging in to your server, you need to download the ionCube Loader archive from the official website, and extract it. To do this, you can run the following commands:

cd /tmp/
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -zxvf ioncube_loaders_lin_x86-64.tar.gz

The previous command should show an output similar to the above screenshot. After extracting the archive, it will be available in the /tmp directory. However, we need to install it in our PHP environment.

In this section, we have provided the instructions to install ionCube Loader on PHP 8.1, but the steps are similar for any other version of PHP.

To install ionCube, you need to copy the relevant shared library file in the PHP’s directory. Change into the installation directory of PHP 8.1 using the following command:

cd /usr/local/lsws/lsphp81/lib/php
ls

After navigating to the correct directory, you can browse its contents. In the above screenshot, we can see it has two folders, one named 20210902 and the other is named 8.1.

Execute the following commands to copy the shared library file of ionCube Loader for PHP 8.1 into the folder named 20210902. These commands will also create an entry in the mods-available directory to load the ionCube Loader next time PHP is reloaded.

cp /tmp/ioncube/ioncube_loader_lin_8.1.so 20210902/
echo "zend_extension=ioncube_loader_lin_8.1.so" > /usr/local/lsws/lsphp81/etc/php/8.1/mods-available/ioncube.ini

If you want to install the loader for multiple PHP versions, you need to perform the above step for each version. Finally, you need to restart the PHP environments for the changes to take effect – run the following commands to do this:

# For OpenLiteSpeed servers
systemctl restart lsws-rc
killall lsphp

On Nginx Servers

Similar for OpenLiteSpeed servers, to install ionCube Loader on Nginx servers, you need to log in to your web server as root, and run the following commands to download and extract the archive:

cd /tmp/
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 extracted the archive, you’re ready to install the ionCube Loader. Execute the following commands to copy the shared library files in the correct location, update the relevant configuration, and to restart the PHP-fpm:

(Again, we have only provided the commands for PHP 8.1 but the process is similar for all versions of PHP. )

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 run one line of code, which will vary depending on your PHP version, as shown below:

For OpenLiteSpeed

/usr/local/lsws/lsphp81/bin/php -m | grep -i ioncube

For Nginx

/RunCloud/Packages/php81rc/bin/php -m | grep -i ioncube

The above command will use the specified version of PHP to list out all the installed modules and display all the lines that contain the word ionCube. If your installation was successful, you will see the following output:

For All PHP Versions and Server Stacks

If you don’t want to check the installed modules via the command line, you can also do it using the web interface. This method will work on all the PHP versions, regardless of your server stack.

After installing the module, make sure you have restarted your web server. Next, go to your RunCloud dashboard and select the application where you want to use ionCube Loader. Click on the “File Manager” tab on the left, and then create a new PHP file. You can name it anything – for example abcd.php.

Next, click on the newly created file, which will open up a text editor in a new window. You need to edit this file by pasting in the following code, and saving it:

<?php phpinfo(); ?>

Open this file in your browser. For example, if the URL of your site is www.example.com, you need to visit www.example.com/abcd.php to open it. You should see something like the screenshot below. Scroll down to find the version of ionCube Loader.

In the above screenshot, we can see that the ionCube Loader is being displayed, therefore it was installed correctly. If the page fails to load or the entry is missing, then it was not installed correctly.

After checking the installation, we strongly recommend deleting this configuration file. It reveals sensitive information about your server to the internet that can be used by hackers to target you.

Backwards Compatibility 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.   

Conclusion

ionCube’s tools are hugely valuable in both protecting and optimizing your PHP code. By encrypting and obfuscating your code, you are guarding it from prying eyes, and 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 the code before sending it 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 a more enjoyable user experiences overall.