IonCube lets you protect your website’s PHP code from being viewed and ran on unlicensed computers. IonCube Loaders is an encryption/decryption utility for PHP applications which also assists in speeding up the pages that are served. Using ionCube, encoded and secured PHP files require a file called ionCube Loader to be installed on the web server and made available to PHP. IonCube Loader is often required for a lot of PHP-based applications; it handles the reading and execution of encoded files at runtime. PHP can use the loader with one line added to a PHP configuration file `php.ini`.
In this article, I will setup the installation of Ioncube Loader on Ubuntu 14.04 LTS, so that it can be used in all PHP Modes. The only requirement for this tutorial is to have php.ini file exist in your system with LEMP stack installed.
Let’s download the latest IonCube loader package by issuing the following `wget` command with super user privileges or root user according to your operating system architecture, we are using the 64-bit OS.
root@ubuntu-14:~# wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
Extract the Contents
Now unpack the archive into the desired folder, usually it’s `/usr/local/src/` folder, by issuing the following commands.
root@ubuntu-14:~# tar -zxvf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local/src/
After extracting the archive, we can list the `/usr/local/src/` and view its packages as shown.
Now clean up the home directory with `rm` command and proceed with the configuration of IonCube Loader.
root@ubuntu-14:~# rm ioncube_loaders_lin_x86-64.tar.gz
IonCube Loader Configuration
We will find the right ionCube extension file to load as it depends on the PHP version. So, issue the following command to find the version number of PHP on your server.
With reference to the output of the command above, we came to know that the PHP version is `5.5.9`, so we need to copy the appropriate module to the PHP modules folder.
Create a new folder for `ioncube` within the `/usr/local/` directory and copy the required extensions into it.
root@ubuntu-14:/usr/local/src/ioncube# mkdir /usr/local/ioncube/ root@ubuntu-14:/usr/local/src/ioncube# cp ioncube_loader_lin_5.5.so ioncube_loader_lin_5.5_ts.so /usr/local/ioncube/
Now we need to put the following line into the `php.ini` file which is located in ` /etc/php5/cli/` folder if you are using Ubuntu and then restart your web server’s services and php.
root@ubuntu-14:~# vim /etc/php5/cli/php.ini
Add the line below under the `Dynamic Extensions` section and save the changes.
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.5.so :wq!
In our scenario, we have Nginx web server installed so we will run the following commands to start its services.
root@ubuntu-14:~# service php5-fpm restart php5-fpm start/running, process 3028 root@ubuntu-14:~# service nginx restart * Restarting nginx nginx
Testing IonCube Loader
To test the ioncube loader in the PHP configuration for your website, create a test file called `info.php` with the following content and place it into the web directory of your web server.
root@ubuntu-14:~# vim /usr/share/nginx/html/info.php <?php phpinfo(); ?>
Then save the changes and access `info.php` in your browser with your domain name or server’s IP address after reloading the web server services.
You will be able to see the section below at the bottom of your php modules information.
From the terminal, issue the following command to verify the php version that shows the ionCube PHP Loader Enabled.
root@ubuntu-14:~# php5 -v
At the end of this tutorial you learned about the installation and configuration of ionCube Loader on Ubuntu with Nginx web server. There will be no difference if you are using any other web server. Installing Loaders is easy when done correctly, and on most servers its installation will work without a problem. However, there is no such thing as a “standard PHP installation”, and servers can be setup in many different ways, and with different features enabled or disabled.
If you are on a shared server, make sure that you run the ioncube-loader-helper.php script, and click the link to test runtime installation. If you still face an issue while doing your setup, feel free to contact us and leave us a comment.
Sign up now to get a free cloud strategy session with our experts.
Spend 30 minutes with our experts to listen to your business challenges and discuss how to design, migrate and/or architect your cloud solution to help you meet your objectives.Sign Up Now