Step 1: Update Your System

Before proceeding, ensure your system is up to date. Run the following commands:

sudo apt update && sudo apt upgrade -y

Step 2: Download the Latest IonCube Loader

Download the latest version of IonCube for Linux (64-bit):

cd /usr/local/src
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Extract the archive:

tar -xvzf ioncube_loaders_lin_x86-64.tar.gz

Step 3: Find the PHP Extension Directory

Determine the PHP extension directory by running:

php -i | grep extension_dir

This will return a path, such as:

extension_dir => /usr/lib/php/20220829

Make a note of this path.

Step 4: Move the IonCube Loader to the PHP Extensions Directory

Move the appropriate IonCube loader file to the PHP extension directory:

sudo cp ioncube/ioncube_loader_lin_8.2.so /usr/lib/php/20220829/

Step 5: Find the Correct PHP INI File

To locate the active php.ini File, use:

php -i | grep "Loaded Configuration File"

You should see an output like this:

Loaded Configuration File => /etc/php/8.2/apache2/php.ini

Make a note of this path.

To find the php.ini file used by the PHP CLI, run:

php -i | grep 'php.ini'

Example output:

Configuration File (php.ini) Path => /etc/php/8.2/cli
Loaded Configuration File => /etc/php/8.2/cli/php.ini

This confirms the exact php.ini file used by the CLI.

Step 6: Edit PHP.ini to Enable IonCube

Open the php.ini file in a text editor:

sudo nano /etc/php/8.2/apache2/php.ini

Add the following line at the very top:

zend_extension = "/usr/lib/php/20220829/ioncube_loader_lin_8.2.so"

Save and exit (Press CTRL + X, then Y, then Enter).

Do the same for the CLI php.ini:

sudo nano /etc/php/8.2/cli/php.ini

Add the same zend_extension line at the top.

Step 7: Restart Apache and PHP-FPM

Restart the webserver and PHP service for changes to take effect:

sudo systemctl restart apache2
sudo systemctl restart php8.2-fpm

Step 8: Verify IonCube Installation

To confirm IonCube is installed correctly, run:

php -v

If installed correctly, you should see something like:

PHP 8.2.10 (cli) (built: Sep 7 2023 08:42:18) (NTS)
with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube.com

Step 9: Enable IonCube for Virtualmin

If you are running Virtualmin with multiple PHP versions, ensure the loader is enabled for all versions. Edit the respective php.ini file inside:

/etc/php/8.2/fpm/php.ini
/etc/php/8.2/cli/php.ini
/etc/php/8.2/apache2/php.ini

Add the same zend_extension line and restart PHP and the web server.

Step 10: Test WHMCS Compatibility

Once IonCube is installed, navigate to WHMCS admin → System Health Status to confirm that IonCube is detected and running properly.

You have now successfully installed IonCube Loader for PHP 8.2 in Virtualmin for WHMCS! 🚀