You are here: Home / Debian GNU/Linux / Servers / PHP / Install IonCube Loader on Debian

Install IonCube Loader on Debian

by Pierre-Yves Landuré last modified Mar 02, 2018 08:35

IonCube Loader is a PHP Zend extension allowing to use licensed PHP files protected with this technology. This post ease its install on Debian.

This how-to is tested on:

  • Debian 6.0 Squeeze
  • Debian 7.0 Wheezy

Prerequisites

This how-to needs :

Installation

Detect the name of the extension configuration file:

MOD_CONF_PATH='/etc/php5/conf.d/000-ioncubeloader.ini'
test -d '/etc/php5/mods-available' \
  && MOD_CONF_PATH='/etc/php5/mods-available/ioncubeloader.ini'

Detect the system architecture:

ARCH="$(command dpkg --print-architecture)"
if [ "${ARCH}" = "i386" ]; then
  ARCH="x86"
elif [ "${ARCH}" = "amd64" ]; then
  ARCH="x86-64"
fi

Detect the PHP version:

PHP_VERSION="$(command php --version 2>'/dev/null' \
    | command head -n 1 \
    | command cut --characters=5-7)"

Environment preparation

Install the PHP command line:

command apt-get install php5-cli

Software installation

Download the software:

command wget "http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_${ARCH}.tar.gz" \
    --output-document="/tmp/ioncube_loaders_lin_${ARCH}.tar.gz"

Extract the downloaded archive:

command tar --directory "/usr/local/" -xzf "/tmp/ioncube_loaders_lin_${ARCH}.tar.gz"

Add the extension to the PHP configuration:

if [ -e "/usr/local/ioncube/ioncube_loader_lin_${PHP_VERSION}.so" ]; then
echo "; configuration for php IonCube Loader module
; priority=05
zend_extension=/usr/local/ioncube/ioncube_loader_lin_${PHP_VERSION}.so" > "${MOD_CONF_PATH}"
test -n "$(command -v php5enmod)" && command php5enmod 'ioncubeloader/05'
fi

Reload the configuration :

test -e '/etc/init.d/php5-fpm' && command service 'php5-fpm' 'restart'
test -e '/etc/init.d/apache2' && command service 'apache2' 'force-reload'

Thanks