Installing Ioncube is a pain in the butt. For some reason they still have the most primitive and manual installation routine of any company around.
Unfortunately some commercial software, e.g. WHMCS, uses it so you have no choice to install it.
As you can see we’re quite negative about the experience. We’re also negative that Ioncube for PHP 8 is not yet available in spite of the practically the entire PHP community having moved on.
Anyway, let’s document our process for installing it for WHMCS on a Laravel Forge server.
- Figure out directories
Even if you know which PHP version you have, you still have to get a grasp on where the hell to put the files. So the search begins.
- Login to Forge
- SUDO
- Start scratching; or
Follow this beautiful Gist pasted here for reference with all 7.1
changed to 7.4
:
https://gist.github.com/mechawrench/af876c97fc5ab4c4e8e1201e6a1a4bf5
The only gotcha is if your PHP command line version is 8.0
it will fail, so make default to 7.4
before running the recipe.
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar zxvf ioncube_loaders_lin_x86-64.tar.gz
PHP_CONFD="/etc/php/7.4/fpm/conf.d"
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
PHP_EXT_DIR=$(php-config --extension-dir)
cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $PHP_EXT_DIR
echo "zend_extension = ${PHP_EXT_DIR}/ioncube_loader_lin_${PHP_VERSION}.so" > "${PHP_CONFD}/00-ioncube.ini"
PHP_CONFD="/etc/php/7.4/cli/conf.d"
PHP_VERSION=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
PHP_EXT_DIR=$(php-config --extension-dir)
cp "ioncube/ioncube_loader_lin_${PHP_VERSION}.so" $PHP_EXT_DIR
echo "zend_extension = ${PHP_EXT_DIR}/ioncube_loader_lin_${PHP_VERSION}.so" > "${PHP_CONFD}/00-ioncube.ini"
rm -rf ./ioncube
rm ioncube_loaders_lin_x86-64.tar.gz
service php7.4-fpm restart
service nginx restart
The guys from Ioncube should take a lesson from this GIST and improve their installation program!