How to Install ionCube Loader in Debian and Ubuntu

ionCube loader is a PHP extension (module) that enables PHP to load files protected and encoded using ionCube Encoder software, which is mostly used in commercial software applications to protect their source code and prevent it from being visible and detectable.

Read Also: How to Install ionCube Loader in CentOS 7

In this article, we will explain how to install and configure ionCube Loader with PHP in Debian and Ubuntu distributions.

Prerequisites:

A Ubuntu or Debian server running with a web server (Apache or Nginx) along with a PHP installed. If you don’t have a web server and PHP on your system, you can install them using apt package manager as shown.

Step 1: Install Apache or Nginx Web Server with PHP

1. If you already have a running web server Apache or Nginx with PHP installed on your system, you can jump to Step 2, otherwise use the following apt command to install them.

-------------------- Install Apache with PHP --------------------
$ sudo apt install apache2 php7.0 php7.0-fpm php7.0-cli 

-------------------- Install Nginx with PHP -------------------- 
$ sudo apt install nginx php7.0 php7.0-fpm php7.0-cli

2. Once you’ve installed Apache or Nginx with PHP on your system, you can start the webserver and activate it to auto-start at system boot using following commands.

-------------------- Start Apache Web Server --------------------
$ sudo systemctl start apache2
$ sudo systemctl enable apache2

-------------------- Start Nginx + PHP-FPM Server --------------------
$ sudo systemctl start nginx
$ sudo systemctl enable nginx
$ sudo systemctl start php7.0-fpm
$ sudo systemctl enable php7.0-fpm

Step 2: Download IonCube Loader

3. Go to the inocube’s website and download the installation files, but before that, you need to check whether your Linux distribution is running on 64-bit or 32-bit architecture using the following command.

$ uname -r

Linux TecMint 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

The above output clearly shows that the system is running on 64-bit architecture.

As per your Linux distribution architecture, download ioncube loader files to /tmp directory using following wget command.

-------------------- For 64-bit System --------------------
$ cd /tmp
$ wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

-------------------- For 32-bit System --------------------
$ cd /tmp
$ wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

4. Then uncompress the downloaded file using the tar command and switch into the unzipped folder. Then run the ls command to list the various ioncube loader files for different PHP versions.

$ tar -zxvf ioncube_loaders_lin_x86*
$ cd ioncube/
$ ls -l
Ioncube Loader Files
Ioncube Loader Files

Step 3: Install ionCube Loader for PHP

5. In the above screenshot, you will see various ioncube loader files for different PHP versions, you need to select the right ioncube loader for your installed PHP version on your server. To know the currently installed PHP version on your server, run the command.

$ php -v
Check PHP Version in Ubuntu
Check PHP Version in Ubuntu

The above screenshot clearly tells that the system is using PHP 7.0.25 version, in your case, it should be a different version.

6. Next, find the location of the extension directory for PHP version 7.0.25, it is where the ioncube loader file will be installed.

$ php -i | grep extension_dir

extension_dir => /usr/lib/php/20151012 => /usr/lib/php/20151012

7. Next we need to copy ioncube loader for our PHP 7.0.25 version to the extension directory (/usr/lib/php/20151012).

$ sudo cp /tmp/ioncube/ioncube_loader_lin_7.0.so /usr/lib/php/20151012

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 for PHP

8. Now we need to configure ioncube loader to work with PHP, in the php.ini file. Debian and Ubuntu use different php.ini files for PHP CLI and PHP-FPM as shown.

$ sudo vi /etc/php/7.0/cli/php.ini 		#for PHP CLI 
$ sudo vi /etc/php/7.0/fpm/php.ini		#for PHP-FPM & Nginx
$ sudo vi /etc/php/7.0/apache2/php.ini	        #for Apache2	

Then add below line as the first line in the respective php.ini files.

zend_extension = /usr/lib/php/20151012/ioncube_loader_lin_7.0.so

Note: Make sure to replace the extension directory location and PHP version in the above command according to your system configuration.

9. Then save and exit the file. Now we need to restart the Apache or Nginx web server for the ioncube loaders to come into effect.

-------------------- Start Apache Web Server --------------------
$ sudo systemctl restart apache2

-------------------- Start Nginx + PHP-FPM Server --------------------
$ sudo systemctl restart nginx
$ sudo systemctl restart php-fpm

Step 5: Test ionCube Loader

10. Now it’s time to verify that the ionCube loader is properly installed and configured on your server by checking the PHP version one more time. You should be able to see a message indicating that PHP is installed and configured with the ioncube loader extension (status should be enabled), as shown in the output below.

$ php -v

PHP 7.0.25-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.0, Copyright (c) 2002-2018, by ionCube Ltd.
    with Zend OPcache v7.0.25-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

That’s It! In order to secure PHP files, you need to have IonCube loader installed and configured with your installed PHP version, as shown above. We hope that everything worked fine without any issues, otherwise, use the feedback form below to send us your queries.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

8 Comments

Leave a Reply
  1. Hi, I am stuck for hours about this. Please help. I installed step by step on my VPS with php7.2-fpm but still not loaded.

    Here is the top page of my php.ini (/etc/php/7.2/fpm/php.ini):

    zend_extension = /usr/lib/php/20170718/ioncube_loader_lin_7.0.so
    [PHP]

    I also put the line right below [PHP] but still no luck. Thank you.

    Reply
    • Your php version is 7.2 not 7.0, don’t copy and paste commands, you should try this zend_extension = /usr/lib/php/20170718/ioncube_loader_lin_7.2.so below [PHP] in each 3 php.ini files.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.