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 a 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:
Click here to download ionCube Loader
ionCube Loader installation
Check the PHP version
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.
Check if it supports 64-bit using hostnamectl
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.
Jump to /tmp folder
We are going to download the installation files to the tmp folder where the temp files are located. So use the cd /tmp command.
Download ionCube Loader via wget
Then download the ionCube Loader file to your server with wget command.
Unzip the tar file
After the ionCube Loader file is successfully downloaded, unzip the compressed file with the tar -zxvf command.
Check the ionCube files
You can use the cd ioncube; ls -l command to enter the folder and view the contents of the folder.
Find the file compatible with your PHP version
We see that there is a file ioncube_loader_lin_7.4.so compatible with the PHP version on the server. We will move this file to the folder where PHP modules are located.
Find the PHP module directory
You can use “php -i | grep extension_dir” command to show the PHP module 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.
Move the plugin to the PHP module directory
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.
Open php.ini file via nano
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 the extension path in php.ini
Type zend_extension = “extension path” in the appropriate section of your php.ini file and save and exit.
Restart Apache and PHP
Then restart Apache and PHP services.
It’s done!
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 was successfully installed.