Image

Knowledge base → Installing Ioncube for php on Debian 12

[Virtual servers]
Date of publication: 16.10.2023

Ioncube is a PHP module that allows you to work with coded scripts. These scripts are closed code, as a rule, these are commercial systems or modules that are paid. In these scripts, as a rule, a license validity check is used, and so that no one removes this verification code, and the source code itself is not used for commercial purposes by others, it is encoded. This PHP module performs decoding, which makes this type of script work.

For each PHP version you need to install its own version of the module.

1. Download the latest version of Ioncube

x64

wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
x32

wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz

2. Installation

2.1 Determine the presence of php versions on the server

ls /usr/bin/ | grep php

php
php7.3
php8.1

In our case, there are 2 versions installed on the server for which we will configure Ioncube.

2.2 Define the folder where php modules are located for each version

php 7.3

/usr/bin/php7.3 -i | grep extension_dir

extension_dir => /usr/lib/php/20180731 => /usr/lib/php/20180731
php 8.1

/usr/bin/php8.1 -i | grep extension_dir

extension_dir => /usr/lib/php/20210902 => /usr/lib/php/20210902

2.3 Copy modules from the downloaded archive

tar -xvf ioncube_loaders_lin_x86-64.tar.gz -C /var/tmp/
cp /var/tmp/ioncube/ioncube_loader_lin_7.3.so /usr/lib/php/20180731
cp /var/tmp/ioncube/ioncube_loader_lin_7.3_ts.so /usr/lib/php/20180731
cp /var/tmp/ioncube/ioncube_loader_lin_8.1.so /usr/lib/php/20210902
cp /var/tmp/ioncube/ioncube_loader_lin_8.1_ts.so /usr/lib/php/20210902

2.4 Add modules to the configuration file

2.4.1 To run scripts from the console (for cron tasks)

vim /etc/php/7.3/cli/php.ini

[Zend]
zend_extension=/usr/lib/php/20180731/ioncube_loader_lin_7.3.so
zend_extension_ts = /usr/lib/php/20180731/ioncube_loader_lin_7.3_ts.so
vim /etc/php/8.1/cli/php.ini

[Zend]
zend_extension=/usr/lib/php/20210902/ioncube_loader_lin_8.1.so
zend_extension_ts = /usr/lib/php/20210902/ioncube_loader_lin_8.1_ts.so

2.4.2 For the web service, in our example we use fpm

vim /etc/php/7.3/fpm/php.ini

[Zend]
zend_extension=/usr/lib/php/20180731/ioncube_loader_lin_7.3.so
zend_extension_ts = /usr/lib/php/20180731/ioncube_loader_lin_7.3_ts.so
vim /etc/php/8.1/fpm/php.ini

[Zend]
zend_extension=/usr/lib/php/20210902/ioncube_loader_lin_8.1.so
zend_extension_ts = /usr/lib/php/20210902/ioncube_loader_lin_8.1_ts.so

If you are using apache, add the same lines.

2.5 Save and apply the settings

To save changes to configuration files, use the command

:wq

Let's restart the web services

service php7.3-fpm restart
service php8.1-fpm restart

3. Check

php 7.3

/usr/bin/php7.3 -v

PHP 7.3.33-14+0~20230902.114+debian12~1.gbp764b27 (cli) (built: Sep 2 2023 07:12:32) (NTS)
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
     with the ionCube PHP Loader + ionCube24 v13.0.2, Copyright (c) 2002-2023, by ionCube Ltd.
     with Zend OPcache v7.3.33-14+0~20230902.114+debian12~1.gbp764b27, Copyright (c) 1999-2018, by Zend Technologies
php 8.1

/usr/bin/php8.1 -v

PHP 8.1.23 (cli) (built: Oct 6 2023 10:18:33) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.23, Copyright (c) Zend Technologies
     with Zend OPcache v8.1.23, Copyright (c), by Zend Technologies

Done, now the encoded scripts will work correctly on your server.





No Comments Yet