+4 votes
in Tutorials and Guides by (1.5m points)

How to install ionCube Loader on a server

1 Answer

+5 votes
by (725k points)
 
Best answer

Sometimes we find a PHP script protected by ionCube and unless we install the respective module, our server will not support such files. In this small tutorial we will learn to install ionCube Loader on an Ubuntu server , although it is applicable in most Linux distributions (CentOS, Debian, etc).

image

Applications written in PHP present the problem that their source code is fully accessible when distributing them. Given this need to protect the PHP code, different technologies appeared on the market, including ionCube and Zend Guard .

Today we will focus on ionCube, as there are enough commercial scripts written in PHP and that require the installation of ionCube. An example of a well-known commercial script that requires ionCube is WHMCS (Web Hosting Automation Made Easy) .

How to install ionCube Loader on a server with Ubuntu.

Previous steps before installing ionCube Loader.

Before installing ionCube Loader we need to perform a few preliminary steps to know the characteristics of our server. For this we will need access through SSH to the server, for example using PuTTY .

First of all we will need to know the type of architecture of our PHP installation, that is, if it is 32-bit or 64-bit. If our server has the operating system installed in its 64-bit version, it is most likely that we have the 64-bit PHP package installed, but we will make sure.

We use the nano editor to create a file in the root directory of our web server. In my case, the server's root directory is /var/www/html/ , so the command to execute would be:
sudo nano /var/www/html/info.php

I paste as file contents:

<?php phpinfo(); ?>

I save the changes with the CTRL+O key combination and close the editor with the CTRL+X combination.

Now we just have to access the info.php file through the browser. In my case I used the server IP in the URL: http://ip_servidor/info.php

In the phpinfo page that appears in the browser we have to pay attention to the version of PHP that we have installed, which appears above everything in the header (see image) . We also have to consult the «System» row, since if it ends with x86_64 our PHP package is 64-bit and if it ends with i686 it is 32-bit .

image

We will also need to know the path of the PHP extensions, which is identified in the phpinfo information by the row named "extension_dir" .

image

Knowing this information from our server, we can now move on to the next phase, where we will install the ionCube Loader extension for PHP.

Install ionCube Loader.

First we go to the official download page of ionCube Loader and copy the URL of the tar.gz package that corresponds to the architecture of our server. In our case, being 64-bit, we download the file to the server with the following command:
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Next we decompress the package with the command:
tar xvfz ioncube_loaders_lin_x86-64.tar.gz

The ioncube folder containing several files will be created automatically. In our case, the PHP version is 7.0.15, so we will use the file ioncube_loader_lin_7.0.so . We copy this file to the PHP extensions folder that we obtained in the previous steps and for this we execute the command :
sudo cp ioncube/ioncube_loader_lin_7.0.so /usr/lib/php/20151012/

Modify PHP settings to load the ionCube Loader extension.

At this point we can only modify the PHP configuration to load the extension of ionCube Loader. We can do this in two ways:

  • Modifying the php.ini file directly.
  • Create an additional configuration file to load the extension.

Of these two methods, the first is as simple as locating the php.ini configuration file and adding the line:
zend_extension = "/usr/lib/php/20151012/ioncube_loader_lin_7.0.so"

Restart the server and the installation would be complete.

The second option is a bit more complex, but it can avoid conflicts with other extensions. To create the additional configuration file, we will use nano and the path will be the one corresponding to the row "Scan this dir for additional .ini files" of phpinfo, which in our case is /etc/php/7.0/apache2/conf.d .

The name of the configuration file will have the prefix 00 , this guarantees that it will be loaded first, before the rest of the configuration files. We execute the command:
sudo nano /etc/php/7.0/apache2/conf.d/00-ioncube.ini

I paste the content of the file as the line:
zend_extension = "/usr/lib/php/20151012/ioncube_loader_lin_7.0.so"

We only have to restart the server and the installation of ionCube Loader will be completed. To restart in Ubuntu 16.04 we execute the command:

  • If we use Apache: sudo systemctl restart apache2.service
  • If we use Nginx: sudo systemctl restart nginx
  • If we use php-fpm: sudo systemctl restart php7.0-fpm.service

After restarting, we can verify that the ionCube extension is installed by accessing the URL http://ip_servidor/info.php and we see that the text says “ionCube PHP Loader (enabled)” as we see in the following image:

image

The last step would be to delete the info.php file, because we don't need it and it can pose a security risk if it is publicly accessible .


Most popular questions within the last 20 days

...