You may want to encrypt the source code of your PHP application that you have developed if it contains a special code, license system, or a special algorithm and you do not want it to be stolen. Encrypt your PHP source codes easily with the world-famous ionCube encoder tool.
You’ll need a license
You need to purchase a license to encrypt PHP codes with ionCube. But after making the purchase, PHP does not decode and interpret the encrypted file by default. You will need the suitable version of ionCube Loader for Linux, Windows, macOS, and 32-bit and 64-bit architectures for your system.
You need to install the ionCube Loader tool, which is the subject of this article, on your server. You can find your ionCube Loader file suitable for your operating system in the link below:
ionCube Loader installation
Before starting the installation, let’s check our current PHP version. To do this, type php -v on the terminal screen.
On the screenshot above, we see that PHP 7.4.3 is installed on our system. We will also install the ionCube Loader accordingly to this version.
To view the operating system information described in the installation, we type the hostnamectl command and display that it supports 64-bit. Make sure you download your plug-in file from the ionCube link address according to the architecture of the operating system.
We are going to download the installation files to the tmp folder where the temp files are located. So use the cd /tmp command.
Then download the ionCube Loader file to your server with wget command.
After the ionCube Loader file is successfully downloaded, unzip the compressed file with the tar -zxvf command.
You can use the cd ioncube; ls -l command to enter the folder and view the contents of the folder.
We see that there is a file ioncube_loader_lin_7.4.so suitable for the PHP version on the server. We will move this file to the folder where PHP modules are located.
You can use “php -i | grep extension_dir” command to show the PHP modules in directory.
Congratulations! We saw that our directory path is /usr/lib64/php/modules. This may be different for you, make a note of the directory path; we will need it later.
The next step will be to move the ioncube_loader_lin_7.4.so plugin to the modules folder. Edit the directory paths in the command below and continue.
If the plugin has been successfully copied, we need to define it in the PHP configuration file. Open your php.ini file for it.
The PHP.ini file may be in different directories in PHP-CLI and PHP-FPM installations. Find the php.ini file with the commands below.
sudo nano /etc/php/7.4/cli/php.ini #for PHP CLI sudo nano /etc/php/7.4/fpm/php.ini #for PHP-FPM & Nginx $udo nano /etc/php/7.4/apache2/php.ini #for Apache2
Type zend_extension = “extension path” in the appropriate section of your php.ini file and save and exit.
Then restart Apache and PHP services.
We can view the ionCube Loader information by using the php -v command to view the successful completion of the installation. The image below shows it successfully installed.