Enhance PHP installer

This commit is contained in:
Edi Septriyanto
2021-03-05 00:49:47 +07:00
parent ce9a357217
commit cc7492e112
3 changed files with 93 additions and 53 deletions

View File

@@ -126,11 +126,8 @@ function init_imagemagick_install() {
run make
run make install
run ldconfig /usr/local/lib
#run cd ../
#run rm -fr ImageMagick-*
run cd "${CURRENT_DIR}"
;;
*)
# Skip installation.
error "Installer method not supported. ImageMagick installation skipped."

View File

@@ -74,7 +74,7 @@ function install_php_fpm() {
if hash apt 2>/dev/null; then
PHP_PKGS=("php${PHPv} php${PHPv}-bcmath php${PHPv}-bz2 php${PHPv}-calendar php${PHPv}-cli \
php${PHPv}-common php${PHPv}-curl php${PHPv}-dev php${PHPv}-exif php${PHPv}-fpm php${PHPv}-gd \
php${PHPv}-gettext php${PHPv}-gmp php${PHPv}-gnupg php${PHPv}-iconv php${PHPv}-imap php${PHPv}-intl \
php${PHPv}-gettext php${PHPv}-gmp php${PHPv}-iconv php${PHPv}-imap php${PHPv}-intl \
php${PHPv}-json php${PHPv}-mbstring php${PHPv}-mysql php${PHPv}-opcache php${PHPv}-pdo php${PHPv}-posix \
php${PHPv}-pspell php${PHPv}-readline php${PHPv}-ldap php${PHPv}-snmp php${PHPv}-soap php${PHPv}-sqlite3 \
php${PHPv}-tidy php${PHPv}-tokenizer php${PHPv}-xml php${PHPv}-xmlrpc php${PHPv}-xsl php${PHPv}-zip \
@@ -89,7 +89,31 @@ php-pear php-xml pkg-php-tools spawn-fcgi fcgiwrap" "${PHP_PKGS[@]}")
success "PHP ${PHPv} & FPM packages installed."
fi
# Install php geoip?
# Install PHP GnuPG?
if "${AUTO_INSTALL}"; then
if version_older_than "8.0" "${PHPv}"; then
local INSTALL_PHPGNUPG="y"
else
local INSTALL_PHPGNUPG="n"
fi
else
while [[ "${INSTALL_PHPGNUPG}" != "y" && "${INSTALL_PHPGNUPG}" != "n" ]]; do
read -rp "Do you want to install PHP Mcrypt for encryption/decryption? [y/n]: " \
-i n -e INSTALL_PHPGNUPG
done
fi
if [[ ${INSTALL_PHPMCRYPT} == Y* || ${INSTALL_PHPMCRYPT} == y* ]]; then
echo "Installing PHP GnuPG module..."
if [ "${PHPv//.}" -lt "80" ]; then
run apt install -qq -y "php${PHPv}-gnupg"
else
info "GnuPG module is not yet available for PHP ${PHPv} or greater."
fi
fi
# Install PHP GeoIP?
if "${AUTO_INSTALL}"; then
local INSTALL_PHPGEOIP="n"
else
@@ -127,7 +151,7 @@ php-pear php-xml pkg-php-tools spawn-fcgi fcgiwrap" "${PHP_PKGS[@]}")
fi
fi
# Install php mcrypt?
# Install PHP Mcrypt?
if "${AUTO_INSTALL}"; then
if version_older_than "7.2" "${PHPv}"; then
local INSTALL_PHPMCRYPT="y"
@@ -170,7 +194,7 @@ php-pear php-xml pkg-php-tools spawn-fcgi fcgiwrap" "${PHP_PKGS[@]}")
run apt install -qq -y dh-php
# Use libsodium instead.
info "Mcrypt module is deprecated for PHP ${PHPv} or greater, use Libsodium or OpenSSL for encryption."
info "Mcrypt module is deprecated for PHP ${PHPv} or greater, for encryption use Libsodium or OpenSSL instead."
fi
fi
@@ -585,13 +609,17 @@ function init_php_fpm_install() {
8|"all")
# Install all PHP version (except EOL & Beta).
#PHPv="all"
install_php_fpm "5.6"
install_php_fpm "7.0"
install_php_fpm "7.1"
install_php_fpm "7.2"
install_php_fpm "7.3"
install_php_fpm "7.4"
install_php_fpm "8.0"
#install_php_fpm "5.6"
#install_php_fpm "7.0"
#install_php_fpm "7.1"
#install_php_fpm "7.2"
#install_php_fpm "7.3"
#install_php_fpm "7.4"
#install_php_fpm "8.0"
for PHPver in "5.6 7.0 7.1 7.2 7.3 7.4 8.0"; do
install_php_fpm "${PHPver}"
done
;;
*)
#PHPv="unsupported"

View File

@@ -2,7 +2,7 @@
# PHP Loader Installer
# Min. Requirement : GNU/Linux Ubuntu 16.04 & 16.04
# Last Build : 10/01/2020
# Last Build : 03/04/2021
# Author : MasEDI.Net (me@masedi.net)
# Since Version : 1.3.0
@@ -56,7 +56,7 @@ function enable_ioncube() {
# PHP version.
local PHPv="${1}"
if [ -z "${PHPv}" ]; then
PHPv=${PHP_VERSION:-"7.3"}
PHPv=${PHP_VERSION:-"7.4"}
fi
echo "Enable ionCube PHP ${PHPv} loader"
@@ -109,7 +109,7 @@ function disable_ioncube() {
# PHP version.
local PHPv="${1}"
if [ -z "${PHPv}" ]; then
PHPv=${PHP_VERSION:-"7.3"}
PHPv=${PHP_VERSION:-"7.4"}
fi
echo "Disabling ionCube PHP ${PHPv} loader"
@@ -125,7 +125,7 @@ function remove_ioncube() {
# PHP version.
local PHPv="${1}"
if [ -z "${PHPv}" ]; then
PHPv=${PHP_VERSION:-"7.3"}
PHPv=${PHP_VERSION:-"7.4"}
fi
echo "Uninstalling ionCube PHP ${PHPv} loader..."
@@ -186,7 +186,7 @@ function enable_sourceguardian() {
# PHP version.
local PHPv="${1}"
if [ -z "${PHPv}" ]; then
PHPv=${PHP_VERSION:-"7.3"}
PHPv=${PHP_VERSION:-"7.4"}
fi
echo "Enable SourceGuardian PHP ${PHPv} loader..."
@@ -240,7 +240,7 @@ function disable_sourceguardian() {
# PHP version.
local PHPv="${1}"
if [ -z "${PHPv}" ]; then
PHPv=${PHP_VERSION:-"7.3"}
PHPv=${PHP_VERSION:-"7.4"}
fi
echo "Disabling SourceGuardian PHP ${PHPv} loader"
@@ -256,7 +256,7 @@ function remove_sourceguardian() {
# PHP version.
local PHPv="${1}"
if [ -z "${PHPv}" ]; then
PHPv=${PHP_VERSION:-"7.3"}
PHPv=${PHP_VERSION:-"7.4"}
fi
echo "Uninstalling SourceGuardian PHP ${PHPv} loader..."
@@ -318,7 +318,7 @@ function init_phploader_install() {
if [ -n "${OPT_PHP_VERSION}" ]; then
PHP_VERSION=${OPT_PHP_VERSION}
else
PHP_VERSION=${PHP_VERSION:-"7.3"}
PHP_VERSION=${PHP_VERSION:-"7.4"}
fi
if [ -n "${OPT_PHP_LOADER}" ]; then
@@ -468,17 +468,21 @@ function init_phploader_install() {
enable_ioncube "${PHPv}"
# Required for LEMPer default PHP.
if [[ "${PHPv}" != "7.3" && -n $(command -v php7.3) ]]; then
enable_ioncube "7.3"
if [[ "${PHPv}" != "7.4" && -n $(command -v php7.4) ]]; then
enable_ioncube "7.4"
fi
else
# Install all PHP version (except EOL & Beta).
enable_ioncube "5.6"
enable_ioncube "7.0"
enable_ioncube "7.1"
enable_ioncube "7.2"
enable_ioncube "7.3"
enable_ioncube "7.4"
#enable_ioncube "5.6"
#enable_ioncube "7.0"
#enable_ioncube "7.1"
#enable_ioncube "7.2"
#enable_ioncube "7.3"
#enable_ioncube "7.4"
for PHPver in "5.6 7.0 7.1 7.2 7.3 7.4 8.0"; do
enable_ioncube "${PHPver}"
done
fi
;;
2|"sg"|"sourceguardian")
@@ -488,17 +492,21 @@ function init_phploader_install() {
enable_sourceguardian "${PHPv}"
# Required for LEMPer default PHP.
if [[ "${PHPv}" != "7.3" && -n $(command -v php7.3) ]]; then
enable_sourceguardian "7.3"
if [[ "${PHPv}" != "7.4" && -n $(command -v php7.4) ]]; then
enable_sourceguardian "7.4"
fi
else
# Install all PHP version (except EOL & Beta).
enable_sourceguardian "5.6"
enable_sourceguardian "7.0"
enable_sourceguardian "7.1"
enable_sourceguardian "7.2"
enable_sourceguardian "7.3"
enable_sourceguardian "7.4"
#enable_sourceguardian "5.6"
#enable_sourceguardian "7.0"
#enable_sourceguardian "7.1"
#enable_sourceguardian "7.2"
#enable_sourceguardian "7.3"
#enable_sourceguardian "7.4"
for PHPver in "5.6 7.0 7.1 7.2 7.3 7.4 8.0"; do
enable_sourceguardian "${PHPver}"
done
fi
;;
"all")
@@ -510,25 +518,32 @@ function init_phploader_install() {
enable_sourceguardian "${PHPv}"
# Required for LEMPer default PHP
if [[ "${PHPv}" != "7.3" && -n $(command -v php7.3) ]]; then
enable_ioncube "7.3"
enable_sourceguardian "7.3"
if [[ "${PHPv}" != "7.4" && -n $(command -v php7.4) ]]; then
enable_ioncube "7.4"
enable_sourceguardian "7.4"
fi
else
# Install all PHP version (except EOL & Beta).
enable_ioncube "5.6"
enable_ioncube "7.0"
enable_ioncube "7.1"
enable_ioncube "7.2"
enable_ioncube "7.3"
enable_ioncube "7.4"
#enable_ioncube "5.6"
#enable_ioncube "7.0"
#enable_ioncube "7.1"
#enable_ioncube "7.2"
#enable_ioncube "7.3"
#enable_ioncube "7.4"
#enable_ioncube "8.0"
enable_sourceguardian "5.6"
enable_sourceguardian "7.0"
enable_sourceguardian "7.1"
enable_sourceguardian "7.2"
enable_sourceguardian "7.3"
enable_sourceguardian "7.4"
#enable_sourceguardian "5.6"
#enable_sourceguardian "7.0"
#enable_sourceguardian "7.1"
#enable_sourceguardian "7.2"
#enable_sourceguardian "7.3"
#enable_sourceguardian "7.4"
#enable_sourceguardian "8.0"
for PHPver in "5.6 7.0 7.1 7.2 7.3 7.4 8.0"; do
enable_ioncube "${PHPver}"
enable_sourceguardian "${PHPver}"
done
fi
;;
*)