Install Ioncube Loader For All PHP Modes (CLI, CGI, FCGI And FPM) On Debian Wheezy

In this tutorial I will explain the installation of Ioncube Loader on Debian Wheezy so that it can be used in all PHP Modes. If one of the php.ini files does not exist on your server, then this php mode is not installed and you can skip that php.ini file.
Download the latest ioncube loaders with wget and unpack the archive:
cd /tmp
wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xfz ioncube_loaders_lin_x86-64.tar.gz

Move the loaders to /usr/local/ and clean up the /tmp directory
mv ioncube /usr/local/
rm ioncube_loaders_lin_x86-64.tar.gz

Configure PHP

Now edit the php.ini files with a editor like vi or nano:
For mod_php:
vi /etc/php5/apache2/php.ini

For CGI and FCGI PHP:
vi /etc/php5/cgi/php.ini

For PHP commandline scripts:
vi /etc/php5/cli/php.ini

For scripts running with PHP-FPM
vi /etc/php5/fpm/php.ini

and add the following line right at the beginning of the file(s) (before the [PHP] line):
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.4.so
so the the resulting file looks like this:
zend_extension = /usr/local/ioncube/ioncube_loader_lin_5.4.so
[PHP]

;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
[…]
Finally restart apache to apply the changes:

service apache2 restart

When you use PHP-FPM, then restart the PHP-FPM pool daemon as well:
service php5-fpm restart

To test that the ioncube loader has been included in the PHP configuration of your website correctly, create a info.php test file with the following content and place it into the web directory of your site:
vi info.php

With the following content:
<?php
phpinfo();
?>

And open the URL in a web browser, you should see ioncube loader mentioned there:

Please do not forget to delete the info.php file when you dont need it anymore!