[SCRIPT] Ioncube update

Hello!
In case anyone needs it, I’m sharing a script for updating IonCube to the latest version on an existing panel. It might be useful.

#!/bin/bash
# ================================================
# Simple IonCube updater for HestiaCP
# Always installs the LATEST version for all PHP versions
# Supports x86_64 and ARM64 (aarch64)
# ================================================

source /etc/hestiacp/hestia.conf

echo "Detecting system architecture..."

arc=$(uname -m)

case "$arc" in
    x86_64)
        arc="x86-64"
        ;;
    aarch64|arm64)
        arc="aarch64"
        ;;
    *)
        echo "Unsupported architecture: $arc"
        exit 1
        ;;
esac

echo "Detected architecture: $arc"
echo "Downloading the latest IonCube version..."

url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_$arc.tar.gz"

if ! wget -qO - "$url" | tar -xz; then
    echo "Failed to download or extract IonCube loaders"
    exit 1
fi

if [ ! -d "./ioncube" ]; then
    echo "IonCube directory was not extracted"
    exit 1
fi

echo "Updating IonCube for all installed PHP versions..."

for php_version in $($HESTIA/bin/v-list-sys-php plain); do

    loader="./ioncube/ioncube_loader_lin_$php_version.so"

    if [ ! -f "$loader" ]; then
        echo "PHP $php_version is not supported by the current IonCube version"
        continue
    fi

    # Properly detect extension_dir
    extension_dir=$(/usr/bin/php$php_version -i 2>/dev/null | grep '^extension_dir' | awk -F'=> ' '{print $2}' | awk '{print $1}' | head -1)

    if [ -z "$extension_dir" ] || [ ! -d "$extension_dir" ]; then
        echo "Failed to detect extension_dir for PHP $php_version"
        continue
    fi

    # Backup existing loader if present
    if [ -f "$extension_dir/ioncube_loader_lin_$php_version.so" ]; then
        cp -f \
            "$extension_dir/ioncube_loader_lin_$php_version.so" \
            "$extension_dir/ioncube_loader_lin_$php_version.so.bak"
    fi

    # Install new loader
    cp -f "$loader" "$extension_dir/ioncube_loader_lin_$php_version.so"

    # Rewrite configuration files
    echo "zend_extension=ioncube_loader_lin_$php_version.so" > "/etc/php/$php_version/fpm/conf.d/00-ioncube-loader.ini"
    echo "zend_extension=ioncube_loader_lin_$php_version.so" > "/etc/php/$php_version/cli/conf.d/00-ioncube-loader.ini"

    # Verify installation
    if /usr/bin/php$php_version -m 2>/dev/null | grep -qi ionCube; then
        echo "IonCube successfully updated for PHP $php_version"
    else
        echo "IonCube verification failed for PHP $php_version"
    fi

done

echo "Restarting all PHP-FPM services..."
$HESTIA/bin/v-restart-service 'php-fpm' yes

# Cleanup
rm -rf ioncube

echo "Done! IonCube has been updated to the latest version for all PHP versions."

The most current version is:
with the ionCube PHP Loader v15.5.0, Copyright (c) 2002-2026, by ionCube Ltd.

Please note that this script only updates existing versions, but does not install them.

To install, use

6 Likes