IonCube is a commercial software suite consisting of a PHP encoder, package foundry, bundler, a real-time site intrusion detection and error reporting application, and a loader. IonCube is a PHP module extension that loads encrypted PHP files and speeds up web pages that are being displayed.
IonCube is often required for a lot of PHP-based applications. It is mostly used in commercial software applications to protect their source code and prevent it from being visible. This article will show you how to install and configure the ionCube Loader with PHP in CentOS 7.
Before proceeding, it's important to verify which version of CentOS you are using to ensure compatibility. Learn how to check your CentOS version here.
Prerequisites
Before we get started, we will need to have the following:
- Must have a running webserver with PHP installed (Nginx or Apache)
- Access to the root user account or an account with sudo privileges
- Basic understanding of Linux commands
To get started with Apache on CentOS, follow our guide on how to install Apache on CentOS to ensure your web server is properly configured before proceeding with IonCube Loader installation.
Step 1: Install the LAMP server
We will need to set up a web server for the following tutorial. In this tutorial, we will assume that you have LAMP set up on your CentOS 7 server. Check out our article on how to install LAMP stack on CentOS and proceed to step 2.
Note that you can install any kind of web server which contains PHP.
Step 2: Download IonCube Loader
There are two different downloader files for 32-bit and 64-bit operating systems. Therefore, first, we will check what operating system we have. Enter the following command to find exactly how your system is running:
uname –a
Output:
Linux 1gbits.com 4.15.0-1.el7.elrepo.x86_64 #1 SMP Sun Jan 28 20:45:20 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
The above output clearly states that the system is running on 64-bit architecture.
Now that we know the architecture of our system, we will go ahead and download the relevant ionCube Loader files.
To further enhance the performance of your PHP environment, you might also consider installing XCache for PHP caching. Learn how to install XCache on CentOS by following this guide.
- For 64-bit:
cd /tmp
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
- For 32-bit:
cd /tmp
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
Once the download is complete, you can use the tar command to unzip the downloaded file. Once done, you can run the ls command to list the complete ionCube Loader files.
tar -zxvf ioncube_loaders_lin_x86*
cd ioncube/
ls -l
Step 3: Install IonCube Loader
There are different IonCube loader files for various PHP versions. For this reason, you should pay close attention to selecting the right IonCube loader for your installed PHP version on your server. To check your PHP version, run the command:
If you're looking to install a complete hosting control panel that supports multiple PHP versions, you might also be interested in learning how to install Webuzo on CentOS 7, which simplifies server management and comes with a one-click IonCube Loader installation option.
php -v
You will see the PHP version displayed on the terminal. For this tutorial, we will assume the PHP version is 7.2. Note yours down and find the location of the extension directory for the PHP version; it is where the IonCube loader file will be installed.
ls ioncube
Find the following files:
ioncube_loader_lin_7.2_ts.so and ioncube_loader_lin_7.2.so
We will use the ‘ioncubeloaderlin_7.2.so’ file because it matches our PHP version. You must use the appropriate file if you have a different version of PHP installed on your server.
To find out the location of the extension directory, run the following command.
php -i | grep extension_dir
extension_dir => /usr/lib64/php/modules => /usr/lib64/php/modules
Note that the path may vary from system to system!
Next we need to copy ioncube loader for our PHP 7.2 version to the extension directory (/usr/lib64/php/modules).
cp ioncube/ioncube_loader_lin_7.2.so /usr/lib64/php/modules
Note: Make sure to replace the PHP version and extension directory in the above command according to your system configuration.
Step 4: Configure ionCube Loader
In this step, we will make some configurations for ionCube Loader. Open the php.ini file using the nano text editor:
nano /etc/php.ini
In the opened file, add the following:
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.2.so
Now, save and exit the file. Everything is set in place. You should restart the Apache or Nginx web server for the ionCube Loader changes to come into effect.
- For Apache webserver:
systemctl restart httpd
- For Nginx +PHP-FPM web server:
systemctl restart nginx
systemctl restart php-fpm
Step 5: Testing the ionCube Loader
Check your PHP version to test if the IonCube loader is installed and properly configured on your server. You should be able to see a message indicating that PHP is installed and configured with the ionCube loader extension (status should be enabled).
php -v
Conclusions
Congratulations on setting up the ionCube Loader on your CentOS server! The ionCube Loader is a PHP extension that allows you to load files secured and encoded with a PHP encoder. We hope that everything worked fine while following this guide. If you encounter any issues or have questions, don’t hesitate to reach out to us via the dedicated comment section below. Your feedback is important, and we're here to help!
If you're looking to enhance your server's capabilities further, you might want to check out our guide on installing Webmin on CentOS. Webmin is a powerful web-based interface that simplifies server management, making it easier to manage services, users, and more.
People also read: