How to install ioncube on separate PHP-FPM

Post Reply
User avatar
isscbta
Team Member
Posts: 130
Joined: Mon Jul 19, 2021 1:41 am
Has thanked: 15 times
Been thanked: 3 times

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

In your SSH, as root, run the following:

Define variables for desired version:

Code: Select all

PHPVER="7.4" # here enter desired PHP version
PHPVERSHORT=$(echo $PHPVER | sed "s|\.||g")
Copy required files:

Code: Select all

wget -nv http://dl.myvestacp.com/php-fpm-ioncube.zip -O php-fpm-ioncube.zip
unzip php-fpm-ioncube.zip

mkdir -p /etc/php/$PHPVER/fpm/pool.d-ioncube
cp php-fpm-ioncube/etc/init.d/php$PHPVER-fpm-ioncube /etc/init.d/php$PHPVER-fpm-ioncube
cp php-fpm-ioncube/lib/systemd/system/php$PHPVER-fpm-ioncube.service /lib/systemd/system/php$PHPVER-fpm-ioncube.service
cp php-fpm-ioncube/etc/php/$PHPVER/fpm/php-fpm-ioncube.conf /etc/php/$PHPVER/fpm/php-fpm-ioncube.conf
cp php-fpm-ioncube/etc/php/$PHPVER/fpm/pool.d-ioncube/www.conf /etc/php/$PHPVER/fpm/pool.d-ioncube/www.conf
cp php-fpm-ioncube/usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.tpl /usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.tpl
cp php-fpm-ioncube/usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.stpl /usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.stpl
cp php-fpm-ioncube/usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.sh /usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.sh
chmod a+x /etc/init.d/php$PHPVER-fpm-ioncube
chmod a+x /usr/local/vesta/data/templates/web/apache2/PHP-FPM-$PHPVERSHORT-ioncube.sh
If there are no files for a particular PHP version which you need, create them from existing ones.

Now, let's download ioncube:

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 -l
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 enable php$PHPVER-fpm-ioncube
systemctl start php$PHPVER-fpm-ioncube
And select template:
Screenshot_7.png
Screenshot_7.png (7.35 KiB)

Tags:
Radi
Posts: 7
Joined: Fri Nov 26, 2021 2:33 pm

Can you provide the Vesta templates for newer PHP's (8.0, 8.1, 8.2)? :)
holyjoe
Posts: 5
Joined: Wed Aug 23, 2023 8:49 am

Hi Isscbta,
thanks for the quick reply,
i did try following the instructions on the link before i posted,

from here till
ihttps://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_do ... -64.tar.gz
tar -xvzf ioncube_loaders_lin_x86-64.tar.gz
cd ioncube
ls
here.

but i am lost from the following, don't know where to input the following.

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
Post Reply