Skip to content

Instantly share code, notes, and snippets.

@centminmod
Last active November 9, 2017 23:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save centminmod/e6454678e96687e97842 to your computer and use it in GitHub Desktop.
Save centminmod/e6454678e96687e97842 to your computer and use it in GitHub Desktop.
Install ioncube loader for Centmin Mod .07+ and higher releases. You'd need to rerun this script after you upgrade major PHP versions too.
#!/bin/bash
#############################################################
# official ioncube loader PHP extension Addon for
# Centmin Mod centminmod.com
# written by George Liu (eva2000)
#############################################################
PHPCURRENTVER=$(php -v | awk -F " " '{print $2}' | head -n1 | cut -d . -f1,2)
#############################################################
if [[ "$(expr $PHPCURRENTVER \= 5.7)" = 1 || "$(expr $PHPCURRENTVER \< 5.3)" = 1 ]]; then
echo "Your current PHP version $PHPCURRENTVER is incompatible with ioncube loader"
echo "ioncube loader only supports PHP versions 5.3-5.6 currently"
echo "aborting installation"
exit
fi
echo
echo "ioncube loader installation started"
echo "ioncube loader only supports PHP 5.3, 5.4, 5.5 and 5.6"
echo "ioncube loader does not support PHP 7.0 currently"
echo
cd /svr-setup
mkdir -p ioncube
cd ioncube
if [[ "$(uname -m)" = 'x86_64' ]]; then
wget -cnv http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar xvzf ioncube_loaders_lin_x86-64.tar.gz
else
wget -cnv http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz
tar xvzf ioncube_loaders_lin_x86.tar.gz
fi
# check current PHP version
ICPHPVER=$(php -v | awk -F " " '{print $2}' | head -n1 | cut -d . -f1,2)
PHPEXTDIRD=`cat /usr/local/bin/php-config | awk '/^extension_dir/ {extdir=$1} END {gsub(/\047|extension_dir|=|)/,"",extdir); print extdir}'`
# move current ioncube version to existing PHP extension directory
\cp -f ioncube/ioncube_loader_lin_${ICPHPVER}.so ${PHPEXTDIRD}/ioncube.so
CONFIGSCANDIR='/etc/centminmod/php.d'
if [[ -f "${CONFIGSCANDIR}/ioncube.ini" ]]; then
rm -rf ${CONFIGSCANDIR}/ioncube.ini
fi
touch ${CONFIGSCANDIR}/ioncube.ini
cat > "${CONFIGSCANDIR}/ioncube.ini" <<EOF
zend_extension=${PHPEXTDIRD}/ioncube.so
EOF
ls -lah ${CONFIGSCANDIR}
echo ""
ls -lah ${PHPEXTDIRD}
fpmrestart
echo ""
echo "Check if PHP module: ionCube Loader loaded"
php --ri 'ionCube Loader'
echo
echo "ioncube loader installation completed"
echo "you'll need to rerun ioncube.sh after each major PHP version upgrades"
echo "PHP 5.3 to 5.4 or PHP 5.4 to PHP 5.5 to PHP 5.6"
echo
@Octolus
Copy link

Octolus commented Nov 9, 2017

Will this be updated to 7.1 soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment