How to install Ioncube Loader on CentOS, Debian and Ubuntu

The Ioncube loader is a PHP module to load files that were protected with the Ioncube Encoder software. Ioncube is often used by commercial PHP software vendors to protect their software, so it is likely that you come across an Ioncube encoded file sooner or later when you install extensions for CMS or Shop software written in PHP. In this tutorial, I will explain the installation of the Ioncube loader module in detail for CentOS, Debian, and Ubuntu.

1 Prerequisites

Your server must have the PHP programming language installed. I will use the command line Editor Nano and the command line download application wget. Nano and Wget are installed on most servers, in case they are missing on your server then install them with apt / yum:


yum install nano wget

Debian and Ubuntu

apt-get install nano wget

2 Download Ioncube Loader

The Ioncube loader files can be downloaded free of charge from Ioncube Inc. They exist for 32Bit and 64Bit Linux systems.

In the first step, I will check if the server is a 32Bit or 64Bit system. Run:

uname -a

The output will be similar to this:

Run uname -a command.

When the text contains "x86_64" then the server runs a 64Bit Linux Kerbel, otherwise it's a 32Bit (i386) Kernel. Most current Linux servers run a 64Bit Kernel.

Download the Loader in tar.gz format to the /tmp folder and unpack it:

For 64Bit x86_64 Linux:

cd /tmp
tar xfz ioncube_loaders_lin_x86-64.tar.gz

For 32Bit i386 Linux:

cd /tmp
tar xfz ioncube_loaders_lin_x86.tar.gz

The files get unpacked into a folder with the name "ioncube".

3 Which Ioncube Loader is the right one?

When you run "ls /tmp/ioncube" then you see that there are many loader files in the ioncube directory.

List of ioncube loader files.

The files have a number that corresponds with the PHP version they are made for and there is also a "_ts" (Thread Safe) version of each loader. We will use the version without thread safety here.

To find out the installed php version, run the command:

php -v

The output will be similar to this:

The php -v output.

For this task only the first two digits of the version number in the first result line matter, on this server I'll run PHP 5.6. We note this number as we need it for the next steps.

Now it's time to find out where the extension directory of this PHP version is, run the following command to find the directory name:

php -i | grep extension_dir

The output should be similar to the one from this screenshot:

The PHP extension directory path.

I marked the path in the screenshot, the extension directory on this server is "/usr/lib/php5/20131226". The directory name will be different for each PHP version and Linux distribution, jus use the one you get from the command and not the one that I got here.

No well copy the ioncube loader for our PHP version 5.6 to the extension directory /usr/lib/php5/20131226:

cp /tmp/ioncube/ /usr/lib/php5/20131226/

Replace "5.6" in the above with your PHP version and "/usr/lib/php5/20131226" with the extension directory of your PHP version.

4 Configure PHP for the Ioncube Loader

The next configuration step is a bit different for Centos and Debian/Ubuntu. We will have to add a line:

zend_extension = /usr/lib/php5/20131226/

as first line into the php.ini file(s) of the system. Again, the above path contains the extension directory "/usr/lib/php5/20131226" and the PHP version "5.6", ensure that you replace them to match your system setup. I'll start with the instructions for CentOS.

3.1 Configure Ioncube loader on CentOS

Centos has just one central phhp.ini file where we have to add the ioncube loader to. Open the file /etc/php.ini with an editor:

nano /etc/php.ini

and add "zend_extension =" plus the path to the ioncube loader as the first line in the file.

zend_extension = /usr/lib/php5/20131226/

Then save the file and restart the apache web server:

service httpd restart
service php-fpm restart

3.1 Configure Ioncube loader on Debian and Ubuntu

Debian and Ubuntu use separate php.ini files for PHP CLI (Commandline), CGI, Apache2 and FPM mode. The file paths are:

  • /etc/php5/apache2/php.ini
  • /etc/php5/cli/php.ini
  • /etc/php5/cgi/php.ini
  • /etc/php5/fpm/php.ini

A file has to be edited to enable the ioncube loader into the corresponding PHP mode. You are free to leave out files for PHP modes that you don't use or where you don't need ioncube loader support. It is also possible that you don't have all files on your server, so don't worry when you can't find one of the files.

Apache mod_php

nano /etc/php5/apache2/php.ini

Command line PHP (CLI)

nano /etc/php5/cli/php.ini

PHP CGI (used for CGI and Fast_CGI modes)

nano /etc/php5/cgi/php.ini


nano /etc/php5/fpm/php.ini

and add "zend_extension =" plus the path to the ioncube loader as the first line in the file(s).

zend_extension = /usr/lib/php5/20131226/

Then save the file(s) and restart the apache webserver and php-fpm:

service apache2 restart
service php5-fpm restart

5 Test Ioncube

Let's check if ioncube loader has been installed successfully. First I will test the commandline PHP. Run:

php -v

Ioncube loaded in cli PHP.

I marked the line in white that shows that the ioncube loader has been enabled:

with the ionCube PHP Loader (enabled) + Intrusion Protection from (unconfigured) v5.0.17, Copyright (c) 2002-2015, by ionCube Ltd.

If you like to test the PHP of a website, create an "info.php file with this content:


And open the URL in a web browser. You will be able to see ioncube in the phpinfo() output:

PHP info output with ioncube module loaded.

Share this page:

12 Comment(s)

Add comment


From: Dave

Many thanks, worked a treat!

From: Tudor


I get this error when entering php -v:

Failed loading /usr/lib/php5/20121212+lfs/  /usr/lib/php5/20121212+lfs/ undefined symbol: ts_resource_ex

Failed: command not found


From: Tudor

without the _ts is working...  thank you!

From: vivioo


I have problem,

when I copy        php -i | grep extension_dir      to console and hit enter:

bash-3.2# php -i | grep extension_dirCannot load the ionCube PHP Loader - it was built with configuration API220090626,NTS, whereas running engine is API220100525,NTSZend Guard Loader requires Zend Engine API version 220090626.The Zend Engine API version 220100525 which is installed, is newer.Contact Zend Technologies at for a later version of Zend Guard Loader.extension_dir => ./ => ./sqlite3.extension_dir => no value => no valuebash-3.2#

What now?


I have CentOS release 5.11 final  64bit.

From: luno

Thanks, it was helpful

on Centos i don't needed to add following line 'zend_extension = /usr/lib/php5/20131226/'

From: Kevin

I followed this to update my Centos / Php stack. I ran into problems that I cannot begin to understand. I document them at this thread:

What do you think is happening?

From: Mr.Armaani


On Centos 7.2

I run service php-fpm restart and it gave me following error

Failed to restart php-fpm.service: Unit php-fpm.service failed to load: No such file or directory.

What should I do ?

From: Robin

The installation worked, however it doesn't show up in php -v but it does show up in phpinfo()

The instructions were very clear, thanks.

From: Alexandre de Moraes

Thanks a lot, very helpful.

From: Daniel

Thank you so much! You saved me!

From: Tharindu Kumara

Thanks for the tutorial.



i have problem after installed ioncube not working.


PHP 5.4.28 (cli) (built: May 16 2014 05:18:54) 

Copyright (c) 1997-2014 The PHP Group

Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies

    with the ionCube PHP Loader (enabled) + Intrusion Protection from (unconfigured) v6.0.4, Copyright (c) 2002-2016, by ionCube Ltd.

    with Zend Guard Loader v3.3, Copyright (c) 1998-2013, by Zend Technologies

[email protected] [~]# 


Update file php.ini:




Check command php -v have information with the ionCube PHP Loader (enabled) + Intrusion Protection from (unconfigured) v6.0.4, Copyright (c) 2002-2016, by ionCube Ltd.


Normally it will work, but when running applications remain alert to a higher version 5.1