From dfac1cd8b9acfb059ca25cc8582b1d7b0cff74e7 Mon Sep 17 00:00:00 2001 From: Edi Septriyanto Date: Sat, 11 Jan 2020 00:51:57 +0700 Subject: [PATCH] Moved PHP loader installation. --- scripts/install_phploader.sh | 470 +++++++++++++++++++++++++++++++++++ 1 file changed, 470 insertions(+) create mode 100755 scripts/install_phploader.sh diff --git a/scripts/install_phploader.sh b/scripts/install_phploader.sh new file mode 100755 index 0000000..96b1206 --- /dev/null +++ b/scripts/install_phploader.sh @@ -0,0 +1,470 @@ +#!/usr/bin/env bash + +# PHP Loader Installer +# Min. Requirement : GNU/Linux Ubuntu 14.04 & 16.04 +# Last Build : 10/01/2020 +# Author : ESLabs.ID (eslabs.id@gmail.com) +# Since Version : 1.3.0 + +# Include helper functions. +if [ "$(type -t run)" != "function" ]; then + BASEDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd ) + # shellchechk source=scripts/helper.sh + # shellcheck disable=SC1090 + . "${BASEDIR}/helper.sh" +fi + +# Make sure only root can run this installer script. +requires_root + +## +# Install ionCube Loader. +# +function install_ioncube() { + echo "Selecting ionCube PHP loader..." + + # Delete old loaders file. + if [ -d /usr/lib/php/loaders/ioncube ]; then + echo "Removing old/existing ionCube PHP loader..." + run rm -fr /usr/lib/php/loaders/ioncube + fi + + local CURRENT_DIR && CURRENT_DIR=$(pwd) + run cd "${BUILD_DIR}" + + ARCH=${ARCH:-$(uname -p)} + if [[ "${ARCH}" == "x86_64" ]]; then + run wget -q "http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz" + run tar -xzf ioncube_loaders_lin_x86-64.tar.gz + run rm -f ioncube_loaders_lin_x86-64.tar.gz + else + run wget -q "http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz" + run tar -xzf ioncube_loaders_lin_x86.tar.gz + run rm -f ioncube_loaders_lin_x86.tar.gz + fi + + echo "Installing latest ionCube PHP loader..." + run mv -f ioncube /usr/lib/php/loaders/ + run cd "${CURRENT_DIR}" +} + +## +# Enable ionCube Loader. +# +function enable_ioncube() { + # PHP version. + local PHPv="${1}" + if [ -z "${PHPv}" ]; then + PHPv=${PHP_VERSION:-"7.3"} + fi + + echo "Enabling ionCube PHP${PHPv} loader" + + if "${DRYRUN}"; then + info "ionCube PHP${PHPv} enabled in dryrun mode." + else + if [ -f "/usr/lib/php/loaders/ioncube/ioncube_loader_lin_${PHPv}.so" ]; then + cat > "/etc/php/${PHPv}/mods-available/ioncube.ini" < "/etc/php/${PHPv}/mods-available/sourceguardian.ini" <