-
Notifications
You must be signed in to change notification settings - Fork 3
/
install_ioncube.sh
39 lines (30 loc) · 1.46 KB
/
install_ioncube.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Instals Ioncube on all existing and supported php versions
source /etc/hestiacp/hestia.conf
# Look up what version is used x86_64 needs to become x86-64 instead
# Only tested for aarch and x86_64
arc=$(arch)
if [ $arc = "x86_64" ]; then
arc="x86-64"
fi
# Download url
url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_$arc.tar.gz"
wget $url -O - | tar -xz
for php_version in $($HESTIA/bin/v-list-sys-php plain); do
# Check if ioncube version is supported for example 8.0 is not availble!
if [ ! -f "./ioncube/ioncube_loader_lin_$php_version.so" ]; then
echo "PHP$php_version is currently not supported by ionCube"
continue
fi
# Get extension dir and don't depend on user input
extension_dir=$(/usr/bin/php$php_version -i | grep extension_dir | cut -d' ' -f5);
# Copy ioncube file to extension dir
cp ./ioncube/ioncube_loader_lin_$php_version* $extension_dir
# Add to conf.d folder for php-fpm and cli
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
echo "IonCube has been enabled for PHP$php_version to verify please run /usr/bin/php$php_version -v"
done
$HESTIA/bin/v-restart-service 'php-fpm' yes
#clean up the trash
rm -fr ioncube