How to install ioncube on separate PHP-FPM

Post Reply
User avatar
isscbta
Posts: 61
Joined: Mon Jul 19, 2021 1:41 am

Steps for installing ioncube on a separate PHP-FPM (we do this in order to prevent ioncube bugs from affecting our primary PHP-FPM):

Required files:

Code: Select all

https://drive.google.com/drive/folders/1lmvZm-vw2gl5izlKszZ4IoWxAmDkcRPy?usp=sharing
Use the appropriate files based on which version you need. If there are no files for a particular version which you need, create them from existing ones.

In your SSH, as root, run:

Code: Select all

wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar -xvzf ioncube_loaders_lin_x86-64.tar.gz
cd ioncube
ls
Define variables for desired version:

Code: Select all

PHPVER="7.4" # here enter desired PHP version
PHPVERSHORT='74' # here enter the same but without the dot
Next, you need to set proper permissions for files that you took from the link we provided above:

Code: Select all

chmod 0755 /etc/init.d/php$PHPVER-fpm-ioncube
chmod 0755 /usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.sh
Now let's set some variables:

Code: Select all

php$PHPVER -i | grep extension_dir
The output will be something like this:

Code: Select all

> extension_dir => /usr/lib/php/20170718 => /usr/lib/php/20170718 # this is output example for 7.2
> extension_dir => /usr/lib/php/20190902 => /usr/lib/php/20190902 # this is output example for 7.4
Take the date from above output and set it as variable:

Code: Select all

PHPDATE="20190902"
Next, run:

Code: Select all

cp ioncube_loader_lin_$PHPVER.so /usr/lib/php/$PHPDATE/
cp /etc/php/$PHPVER/fpm/php.ini /etc/php/$PHPVER/fpm/php-ioncube.ini
PHPLINE="zend_extension=/usr/lib/php/$PHPDATE/ioncube_loader_lin_$PHPVER.so"
sed -i "1s|^|$PHPLINE\n\n|" /etc/php/$PHPVER/fpm/php-ioncube.ini
At the end, run:

Code: Select all

systemctl start php$PHPVER-fpm-ioncube
systemctl enable php$PHPVER-fpm-ioncube

Tags:
Post Reply