Enable ioncube PHP extension on Debian 10 (Buster)

ionCube loader is a PHP extension that allows interpreting PHP files protected and encoded with ionCube Encoder. Generally, this software is used to prevent the original source code from being decrypted by third parties.
Before starting with this tutorial we recommend you to visit the following articles if you don't have a PHP environment with Apache on Debian Buster yet:
- Install Apache, PHP and MySQL on Debian 10 (Buster)
- Install PHP extensions on Debian
Installation
The first thing you need to do is go to the ionCube loaders site and download the respective installer for your architecture (x86 / x64).
x64wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
x86
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
Once done, you can unzip the tar archive.
tar -zxvf ioncube_loaders_lin_x86*
cd ioncube/
Now you need to check which PHP version you have installed and which is the directory for the extensions.
user@server:/tmp/ioncube$ php -v | grep PHP
PHP 7.4.18 (cli) (built: May 3 2021 11:59:44) ( NTS )
Copyright (c) The PHP Group
user@server:/tmp/ioncube$ php -i | grep extension_dir
extension_dir => /usr/lib/php/20190902 => /usr/lib/php/20190902
With this information you can copy the extension from the ionCube directory to the directory where your extensions are stored. In this case, we will copy the extension for PHP 7.4 (NTS).
sudo cp ioncube_loader_lin_7.4.so /usr/lib/php/20190902/
The last step is to add the extension to the PHP php.ini file. This will depend on how you installed PHP and where you want to enable the extension. For example, if you want to enable the extension in the Apache web server sites and not in CLI, you will need to modify the following file.
sudo vim /etc/php/7.4/apache2/php.ini
Somewhere in the file, preferably where the other extensions are, you should copy your extension as follows:
zend_extension=/usr/lib/php/20190902/ioncube_loader_lin_7.4.so
Finally, you can restart your server and run those applications that require ionCube.
sudo systemctl restart apache2