Use local php. Part 3
This commit is contained in:
@@ -52,11 +52,13 @@ get_domain_values 'web'
|
|||||||
BACKEND="$template"
|
BACKEND="$template"
|
||||||
|
|
||||||
# Defining pool directory
|
# Defining pool directory
|
||||||
if [ -f "/etc/redhat-release" ]; then
|
pool=""
|
||||||
pool=$(find -L /etc/opt/remi/ -name "$domain.conf" -exec dirname {} \;)
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
|
pool=$(find -L /opt/brepo/ -name "$domain.conf" -exec dirname {} \;)
|
||||||
else
|
else
|
||||||
pool=$(find -L /etc/php/ -name "$domain.conf" -exec dirname {} \;)
|
pool=$(find -L /etc/opt/remi/ -name "$domain.conf" -exec dirname {} \;)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -e "$pool" ]; then
|
if [ ! -e "$pool" ]; then
|
||||||
check_result "$E_NOTEXIST" "php-fpm pool doesn't exist"
|
check_result "$E_NOTEXIST" "php-fpm pool doesn't exist"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -32,27 +32,21 @@ if [ -z "$WEB_BACKEND" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set file locations
|
# Set file locations
|
||||||
if [ -f /etc/redhat-release ]; then
|
php_fpm=""
|
||||||
php_fpm="/usr/lib/systemd/system/php$version-php-fpm.service"
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
|
php_fpm="/usr/lib/systemd/system/brepo-php-fpm$version.service"
|
||||||
else
|
else
|
||||||
php_fpm="/etc/init.d/php$version-fpm"
|
php_fpm="/usr/lib/systemd/system/php$version-php-fpm.service"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Verify php version format
|
# Verify php version format
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [[ ! $version =~ ^[0-9][0-9]+ ]]; then
|
||||||
if [[ ! $version =~ ^[0-9][0-9]+ ]]; then
|
|
||||||
echo "The PHP version format is invalid, it should look like [0-9][0-9]."
|
echo "The PHP version format is invalid, it should look like [0-9][0-9]."
|
||||||
echo "Example: 70, 74, 80"
|
echo "Example: 70, 74, 80"
|
||||||
exit "$E_INVALID"
|
exit "$E_INVALID"
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [[ ! $version =~ ^[0-9].[0-9]+ ]]; then
|
|
||||||
echo "The PHP version format is invalid, it should look like [0-9].[0-9]."
|
|
||||||
echo "Example: 7.0, 7.4, 8.0"
|
|
||||||
exit "$E_INVALID"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Remove backend template
|
# Remove backend template
|
||||||
[ -f $HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl ] && rm -f $HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl
|
[ -f $HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl ] && rm -f $HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl
|
||||||
|
|
||||||
@@ -70,38 +64,33 @@ check_hestia_demo_mode
|
|||||||
# Action #
|
# Action #
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
mph="php$version-common php$version-mbstring php$version-bcmath php$version-cli php$version-curl
|
mph=""
|
||||||
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
|
mph="brepo-php$version brepo-php$version-fpm"
|
||||||
|
else
|
||||||
|
mph="php$version-common php$version-mbstring php$version-bcmath php$version-cli php$version-curl
|
||||||
php$version-fpm php$version-gd php$version-intl php$version-mysql
|
php$version-fpm php$version-gd php$version-intl php$version-mysql
|
||||||
php$version-soap php$version-xml php$version-zip php$version-mbstring
|
php$version-soap php$version-xml php$version-zip php$version-mbstring
|
||||||
php$version-json php$version-bz2 php$version-pspell php$version-imagick php$version-pgsql
|
php$version-json php$version-bz2 php$version-pspell php$version-imagick php$version-pgsql
|
||||||
php$version-imap php$version-ldap"
|
php$version-imap php$version-ldap"
|
||||||
|
|
||||||
if [ -f /etc/redhat-release ]; then
|
|
||||||
# Packages in Remi repo have names with php$version-php- prefixes
|
# Packages in Remi repo have names with php$version-php- prefixes
|
||||||
mph="php$version-php-fpm php$version-php-cgi php$version-php-mysqlnd php$version-php-pgsql
|
mph="php$version-php-fpm php$version-php-cgi php$version-php-mysqlnd php$version-php-pgsql
|
||||||
php$version-php-pdo php$version-php-common php$version-php-pecl-imagick php$version-php-imap
|
php$version-php-pdo php$version-php-common php$version-php-pecl-imagick php$version-php-imap
|
||||||
php$version-php-ldap php$version-php-pecl-apcu php$version-php-pecl-zip php$version-php-cli
|
php$version-php-ldap php$version-php-pecl-apcu php$version-php-pecl-zip php$version-php-cli
|
||||||
php$version-php-opcache php$version-php-xml php$version-php-gd php$version-php-intl
|
php$version-php-opcache php$version-php-xml php$version-php-gd php$version-php-intl
|
||||||
php$version-php-mbstring php$version-php-pspell php$version-php-readline"
|
php$version-php-mbstring php$version-php-pspell php$version-php-readline"
|
||||||
fi
|
|
||||||
|
|
||||||
# Check is version is 7.1 or below to add mcrypt
|
|
||||||
if [ -f /etc/redhat-release ]; then
|
# Check is version is 7.1 or below to add mcrypt
|
||||||
if [[ $(echo "$version 72" | awk '{print ($1 < $2)}') == 1 ]]; then
|
if [[ $(echo "$version 72" | awk '{print ($1 < $2)}') == 1 ]]; then
|
||||||
mph="$mph php$version-php-mcrypt"
|
mph="$mph php$version-php-mcrypt"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
if [[ $(echo "$version 7.2" | awk '{print ($1 < $2)}') == 1 ]]; then
|
|
||||||
mph="$mph php$version-mcrypt"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Purge php packages
|
# Purge php packages
|
||||||
if [ -f '/etc/redhat-release' ]; then
|
dnf remove -y $mph > /dev/null 2>&1 &
|
||||||
dnf remove -y $mph > /dev/null 2>&1 &
|
|
||||||
else
|
|
||||||
apt-get -y purge $mph > /dev/null 2>&1 &
|
|
||||||
fi
|
|
||||||
BACK_PID=$!
|
BACK_PID=$!
|
||||||
|
|
||||||
# Check if package removal is done, print a spinner
|
# Check if package removal is done, print a spinner
|
||||||
@@ -119,40 +108,36 @@ echo
|
|||||||
# Check if installation was successfully
|
# Check if installation was successfully
|
||||||
if [ -f "$php_fpm" ]; then
|
if [ -f "$php_fpm" ]; then
|
||||||
echo "ERROR: Uninstallation failed, please run the following command manually for debugging:"
|
echo "ERROR: Uninstallation failed, please run the following command manually for debugging:"
|
||||||
if [ -f '/etc/redhat-release' ]; then
|
|
||||||
echo "dnf remove $mph"
|
echo "dnf remove $mph"
|
||||||
else
|
|
||||||
echo "apt-get purge $mph"
|
|
||||||
fi
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleanup php folder
|
# Cleanup php folder
|
||||||
if [ -f '/etc/redhat-release' ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
[[ -d /etc/opt/remi/php$version ]] && rm -rf "/etc/opt/remi/php$version"
|
[[ -d /opt/brepo/php$version ]] && rm -rf "/opt/brepo/php$version"
|
||||||
else
|
else
|
||||||
[[ -d /etc/php/$version ]] && rm -rf "/etc/php/$version"
|
[[ -d /etc/opt/remi/php$version ]] && rm -rf "/etc/opt/remi/php$version"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f '/etc/redhat-release' ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
|
if [ "$WEB_BACKEND" = "php-fpm" ]; then
|
||||||
|
conf=$(find /opt/brepo/php* -name www.conf)
|
||||||
|
# Check if www.conf exists
|
||||||
|
if [ -z "$conf" ]; then
|
||||||
|
# If not grab the "last php version
|
||||||
|
last=$($BIN/v-list-sys-php "shell" | tail -n1)
|
||||||
|
cp -f $HESTIA/install/rpm/php-fpm/www.conf /opt/brepo/php$last/etc/php-fpm.d/www.conf
|
||||||
|
$BIN/v-restart-web-backend
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
if [ "$WEB_BACKEND" = "php-fpm" ]; then
|
if [ "$WEB_BACKEND" = "php-fpm" ]; then
|
||||||
conf=$(find /etc/opt/remi/php* -name www.conf)
|
conf=$(find /etc/opt/remi/php* -name www.conf)
|
||||||
# Check if www.conf exists
|
# Check if www.conf exists
|
||||||
if [ -z "$conf" ]; then
|
if [ -z "$conf" ]; then
|
||||||
# If not grab the "last php version
|
# If not grab the "last php version
|
||||||
last=$($BIN/v-list-sys-php "shell" | tail -n1)
|
last=$($BIN/v-list-sys-php "shell" | tail -n1)
|
||||||
cp -f $HESTIA/install/rpm/php-fpm/www.conf /etc/opt/remi/php$version/php-fpm.d/www.conf
|
cp -f $HESTIA/install/rpm/php-fpm/www.conf /etc/opt/remi/php$last/php-fpm.d/www.conf
|
||||||
$BIN/v-restart-web-backend
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$WEB_BACKEND" = "php-fpm" ]; then
|
|
||||||
conf=$(find /etc/php* -name www.conf)
|
|
||||||
# Check if www.conf exists
|
|
||||||
if [ -z "$conf" ]; then
|
|
||||||
# If not grab the "last php version
|
|
||||||
last=$($BIN/v-list-sys-php "shell" | tail -n1)
|
|
||||||
cp -f $HESTIA/install/deb/php-fpm/www.conf /etc/php/$last/fpm/pool.d/www.conf
|
|
||||||
$BIN/v-restart-web-backend
|
$BIN/v-restart-web-backend
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -67,14 +67,14 @@ csv_list() {
|
|||||||
|
|
||||||
declare -a versions
|
declare -a versions
|
||||||
# List through /etc/php
|
# List through /etc/php
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
for version in /etc/opt/remi/php*/php-fpm.d/www.conf; do
|
for version in /opt/brepo/php*/etc/php-fpm.d/www.conf; do
|
||||||
ver=$(echo "$version" | awk -F"/" '{ print $5 }' | sed "s/php\([[:digit:]]\+\)/\1/g")
|
ver=$(echo "$version" | awk -F"/" '{ print $4 }' | sed "s/php\([[:digit:]]\+\)/\1/g")
|
||||||
versions+=("$ver")
|
versions+=("$ver")
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
for version in /etc/php/*/fpm/pool.d/www.conf; do
|
for version in /etc/opt/remi/php*/php-fpm.d/www.conf; do
|
||||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
ver=$(echo "$version" | awk -F"/" '{ print $5 }' | sed "s/php\([[:digit:]]\+\)/\1/g")
|
||||||
versions+=("$ver")
|
versions+=("$ver")
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -67,21 +67,29 @@ csv_list() {
|
|||||||
|
|
||||||
declare -a versions
|
declare -a versions
|
||||||
# List through /etc/php
|
# List through /etc/php
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
for version in /etc/opt/remi/php*/; do
|
|
||||||
ver=$(echo "$version" | awk -F"/" '{ print $5 }' | sed 's|php||')
|
|
||||||
versions+=("$ver")
|
|
||||||
done
|
|
||||||
else
|
|
||||||
if [ -n "$WEB_BACKEND" ]; then
|
if [ -n "$WEB_BACKEND" ]; then
|
||||||
for version in /etc/php/*/fpm; do
|
for version in /opt/brepo/php*/; do
|
||||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
ver=$(echo "$version" | awk -F"/" '{ print $4 }' | sed 's|php||')
|
||||||
versions+=("$ver")
|
versions+=("$ver")
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
# Fix for modphp
|
# Fix for modphp
|
||||||
for version in /etc/php/*/cli; do
|
for version in /opt/brepo/php*/bin/php; do
|
||||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
ver=$(echo "$version" | awk -F"/" '{ print $4 }' | sed 's|php||')
|
||||||
|
versions+=("$ver")
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -n "$WEB_BACKEND" ]; then
|
||||||
|
for version in /etc/opt/remi/php*/; do
|
||||||
|
ver=$(echo "$version" | awk -F"/" '{ print $5 }' | sed 's|php||')
|
||||||
|
versions+=("$ver")
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# Fix for modphp
|
||||||
|
for version in /opt/remi/php*/root/bin/php; do
|
||||||
|
ver=$(echo "$version" | awk -F"/" '{ print $4 }' | sed 's|php||')
|
||||||
versions+=("$ver")
|
versions+=("$ver")
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -63,22 +63,23 @@ csv_list() {
|
|||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Defining config path
|
# Defining config path
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
config_path=$(find /etc/opt/remi/php* -name php.ini)
|
config_path=$(find /opt/brepo/php* -name php.ini)
|
||||||
else
|
else
|
||||||
config_path=$(find /etc/php* -name php.ini)
|
config_path=$(find /etc/opt/remi/php* -name php.ini)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
config_count=$(echo "$config_path" | wc -l)
|
config_count=$(echo "$config_path" | wc -l)
|
||||||
if [ "$config_count" -gt 1 ]; then
|
if [ "$config_count" -gt 1 ]; then
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
multiphp_versions=$(ls -d /etc/opt/remi/php*/php-fpm.d 2> /dev/null | wc -l)
|
multiphp_versions=$(ls -d /opt/brepo/php*/etc/php-fpm.d 2> /dev/null | wc -l)
|
||||||
else
|
else
|
||||||
multiphp_versions=$(ls -d /etc/php/*/fpm/pool.d 2> /dev/null | wc -l)
|
multiphp_versions=$(ls -d /etc/opt/remi/php*/php-fpm.d 2> /dev/null | wc -l)
|
||||||
fi
|
fi
|
||||||
if [ "$WEB_BACKEND" = 'php-fpm' ] || [ "$multiphp_versions" -gt 0 ]; then
|
if [ "$WEB_BACKEND" = 'php-fpm' ] || [ "$multiphp_versions" -gt 0 ]; then
|
||||||
config_path=$(echo "$config_path" | grep fpm)
|
config_path=$(echo "$config_path" | grep fpm)
|
||||||
else
|
else
|
||||||
config_path=$(echo "$config_path" | grep apache)
|
config_path=$(echo "$config_path" | grep httpd)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ get_srv_state() {
|
|||||||
rtime="0"
|
rtime="0"
|
||||||
|
|
||||||
# Searching related pids
|
# Searching related pids
|
||||||
if [ -f /etc/redhat-release ] && [ "$name" = "php-fpm" ]; then
|
if [ "$name" = "php-fpm" ]; then
|
||||||
pids=''
|
pids=''
|
||||||
for php_pid in $(pidof php-fpm); do
|
for php_pid in $(pidof php-fpm); do
|
||||||
process_info=$(ps -p "$php_pid" -o args | tail -n1 | grep "$srv")
|
process_info=$(ps -p "$php_pid" -o args | tail -n1 | grep "$srv")
|
||||||
@@ -174,8 +174,8 @@ fi
|
|||||||
|
|
||||||
# Checking PHP intepreter
|
# Checking PHP intepreter
|
||||||
if [ -n "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
|
if [ -n "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
php_versions=$(ls /opt/remi/php*/root/sbin/php-fpm | cut -d'/' -f4 | sed 's|php||')
|
php_versions=$(/opt/brepo/php*/sbin/php-fpm | cut -d'/' -f4 | sed 's|php||')
|
||||||
for version in $php_versions; do
|
for version in $php_versions; do
|
||||||
proc_name="php-fpm"
|
proc_name="php-fpm"
|
||||||
service_name="php${version}"
|
service_name="php${version}"
|
||||||
@@ -184,12 +184,12 @@ if [ -n "$WEB_BACKEND" ] && [ "$WEB_BACKEND" != 'remote' ]; then
|
|||||||
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
php_versions=$(ls /usr/sbin/php*fpm* | cut -d'/' -f4 | sed 's|php-fpm||')
|
php_versions=$(ls /opt/remi/php*/root/sbin/php-fpm | cut -d'/' -f4 | sed 's|php||')
|
||||||
for version in $php_versions; do
|
for version in $php_versions; do
|
||||||
proc_name="php-fpm${version}"
|
proc_name="php-fpm"
|
||||||
service_name="php${version}-fpm"
|
service_name="php${version}"
|
||||||
get_srv_state "$service_name" "$proc_name"
|
get_srv_state "$proc_name"
|
||||||
data="$data\nNAME='$service_name' SYSTEM='php interpreter' STATE='$state'"
|
data="$data\nNAME='$service_name-php-fpm' SYSTEM='php interpreter' STATE='$state'"
|
||||||
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
data="$data CPU='$cpu' MEM='$mem' RTIME='$rtime'"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -58,21 +58,21 @@ tmpfile=$(mktemp)
|
|||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
# Substitute php-fpm service name formats
|
# Substitute php-fpm service name formats
|
||||||
for version in $($BIN/v-list-sys-php plain); do
|
for version in $($BIN/v-list-sys-php plain); do
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
v_php="php$version-php-fpm"
|
v_php="brepo-php-fpm$version"
|
||||||
else
|
else
|
||||||
v_php="php$version-fpm"
|
v_php="php$version-php-fpm"
|
||||||
fi
|
fi
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
|
if [ ! -f "/opt/brepo/php${version}/etc/php-fpm.d/dummy.conf" ]; then
|
||||||
|
cp -f $HESTIA_INSTALL_DIR/php-fpm/dummy.conf /opt/brepo/php${version}/etc/php-fpm.d/
|
||||||
|
sed -i "s/9999/99$v_tpl/g" /opt/brepo/php${version}/etc/php-fpm.d/dummy.conf
|
||||||
|
fi
|
||||||
|
else
|
||||||
if [ ! -f "/etc/opt/remi/php${version}/php-fpm.d/dummy.conf" ]; then
|
if [ ! -f "/etc/opt/remi/php${version}/php-fpm.d/dummy.conf" ]; then
|
||||||
cp -f $HESTIA_INSTALL_DIR/php-fpm/dummy.conf /etc/opt/remi/php${version}/php-fpm.d/
|
cp -f $HESTIA_INSTALL_DIR/php-fpm/dummy.conf /etc/opt/remi/php${version}/php-fpm.d/
|
||||||
sed -i "s/9999/99$v_tpl/g" /etc/opt/remi/php${version}/php-fpm.d/dummy.conf
|
sed -i "s/9999/99$v_tpl/g" /etc/opt/remi/php${version}/php-fpm.d/dummy.conf
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
if [ ! -f "/etc/php/${version}/fpm/pool.d/dummy.conf" ]; then
|
|
||||||
cp -f "$HESTIA_INSTALL_DIR/php-fpm/dummy.conf" "/etc/php/${version}/fpm/pool.d/"
|
|
||||||
sed -i "s/9999/99${version//./}/g" "/etc/php/${version}/fpm/pool.d/dummy.conf"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$BIN/v-restart-service "$v_php" "$restart"
|
$BIN/v-restart-service "$v_php" "$restart"
|
||||||
@@ -82,10 +82,10 @@ if [ -z "$version" ]; then
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
v_php="php$version-php-fpm"
|
v_php="brepo-php-fpm$version"
|
||||||
else
|
else
|
||||||
v_php="php$version-fpm"
|
v_php="php$version-php-fpm"
|
||||||
fi
|
fi
|
||||||
$BIN/v-restart-service "$v_php" "$restart"
|
$BIN/v-restart-service "$v_php" "$restart"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
|||||||
@@ -50,11 +50,22 @@ for webtpl_folder in $(ls $HESTIA_INSTALL_DIR/templates/web/* -d 2> /dev/null |
|
|||||||
cp -rf "${webtpl_folder}" "${WEBTPL}/"
|
cp -rf "${webtpl_folder}" "${WEBTPL}/"
|
||||||
done
|
done
|
||||||
|
|
||||||
versions_list=$(ls -d /etc/opt/remi/php*)
|
versions_list=""
|
||||||
for php_ver in $versions_list; do
|
if [ "$LOCAL_PHP" == "yes" ]; then
|
||||||
[ ! -d "$php_ver/fpm/pool.d/" ] && continue
|
versions_list=$(ls -d /opt/brepo/php*)
|
||||||
cp -f $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl ${WEBTPL}/php-fpm/PHP-${php_ver/\./_}.tpl
|
for php_ver in $versions_list; do
|
||||||
done
|
[ ! -d "$php_ver/etc/php-fpm.d" ] && continue
|
||||||
|
vers=$(echo "$php_ver" | awk -F"/" '{ print $4 }' | sed "s/php\([[:digit:]]\+\)/\1/g")
|
||||||
|
cp -f $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl ${WEBTPL}/php-fpm/PHP-${vers/\./_}.tpl
|
||||||
|
done
|
||||||
|
else
|
||||||
|
versions_list=$(ls -d /etc/opt/remi/php*)
|
||||||
|
for php_ver in $versions_list; do
|
||||||
|
[ ! -d "$php_ver/php-fpm.d" ] && continue
|
||||||
|
vers=$(echo "$php_ver" | awk -F"/" '{ print $5 }' | sed "s/php\([[:digit:]]\+\)/\1/g")
|
||||||
|
cp -f $HESTIA_INSTALL_DIR/php-fpm/multiphp.tpl ${WEBTPL}/php-fpm/PHP-${vers/\./_}.tpl
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$awstats_patch" ]; then
|
if [ -n "$awstats_patch" ]; then
|
||||||
# restore LoadPlugin variable
|
# restore LoadPlugin variable
|
||||||
|
|||||||
@@ -101,34 +101,33 @@ is_web_alias_new() {
|
|||||||
prepare_web_backend() {
|
prepare_web_backend() {
|
||||||
# Accept first function argument as backend template otherwise fallback to $template global variable
|
# Accept first function argument as backend template otherwise fallback to $template global variable
|
||||||
local backend_template=${1:-$template}
|
local backend_template=${1:-$template}
|
||||||
|
php_type=$(cat "$HESTIA/conf/hestia.conf" | grep "LOCAL_PHP" | grep "yes")
|
||||||
|
|
||||||
if [ -f "/etc/redhat-release" ]; then
|
if [ -n "$php_type" ]; then
|
||||||
pool=$(find -L /etc/opt/remi/php80/ -name "$domain.conf" -exec dirname {} \; 2>/dev/null)
|
pool=$(find -L /opt/brepo/ -name "$domain.conf" -exec dirname {} \; 2>/dev/null)
|
||||||
else
|
else
|
||||||
pool=$(find -L /etc/php/ -name "$domain.conf" -exec dirname {} \;)
|
pool=$(find -L /etc/opt/remi/php80/ -name "$domain.conf" -exec dirname {} \; 2>/dev/null)
|
||||||
fi
|
fi
|
||||||
# Check if multiple-PHP installed
|
# Check if multiple-PHP installed
|
||||||
if [ -f "/etc/redhat-release" ]; then
|
|
||||||
regex="^.*PHP-([0-9])([0-9])$"
|
regex="^.*PHP-([0-9])([0-9])$"
|
||||||
else
|
|
||||||
regex="^.*PHP-([0-9])\_([0-9])$"
|
|
||||||
fi
|
|
||||||
if [[ $backend_template =~ $regex ]]; then
|
if [[ $backend_template =~ $regex ]]; then
|
||||||
if [ -f "/etc/redhat-release" ]; then
|
if [ -n "$php_type" ]; then
|
||||||
|
backend_version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
|
||||||
|
pool=$(find -L /opt/brepo/php$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
||||||
|
else
|
||||||
backend_version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
|
backend_version="${BASH_REMATCH[1]}${BASH_REMATCH[2]}"
|
||||||
pool=$(find -L /etc/opt/remi/php$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
pool=$(find -L /etc/opt/remi/php$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
||||||
else
|
|
||||||
backend_version="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
|
|
||||||
pool=$(find -L /etc/php/$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
backend_version=$(multiphp_default_version)
|
backend_version=$(multiphp_default_version)
|
||||||
if [ -z "$pool" ] || [ -z "$BACKEND" ]; then
|
if [ -z "$pool" ] || [ -z "$BACKEND" ]; then
|
||||||
if [ -f "/etc/redhat-release" ]; then
|
if [ -n "$php_type" ]; then
|
||||||
|
m_backend_version="${backend_version//./}"
|
||||||
|
pool=$(find -L /opt/brepo/php$m_backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
||||||
|
else
|
||||||
m_backend_version="${backend_version//./}"
|
m_backend_version="${backend_version//./}"
|
||||||
pool=$(find -L /etc/opt/remi/php$m_backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
pool=$(find -L /etc/opt/remi/php$m_backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
||||||
else
|
|
||||||
pool=$(find -L /etc/php/$backend_version -type d \( -name "pool.d" -o -name "*fpm.d" \))
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@@ -151,11 +150,12 @@ prepare_web_backend() {
|
|||||||
|
|
||||||
# Delete web backend
|
# Delete web backend
|
||||||
delete_web_backend() {
|
delete_web_backend() {
|
||||||
if [ -f "/etc/redhat-release" ]; then
|
php_type=$(cat "$HESTIA/conf/hestia.conf" | grep "LOCAL_PHP" | grep "yes")
|
||||||
|
if [ -n "$php_type" ]; then
|
||||||
|
find -L /opt/brepo/php* -name "$backend_type.conf" -exec rm -f {} \;
|
||||||
|
else
|
||||||
find -L /etc/opt/remi/ -name "$backend_type.conf" -exec rm -f {} \;
|
find -L /etc/opt/remi/ -name "$backend_type.conf" -exec rm -f {} \;
|
||||||
else
|
fi
|
||||||
find -L /etc/php/ -type f -name "$backend_type.conf" -exec rm -f {} \;
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prepare web aliases
|
# Prepare web aliases
|
||||||
|
|||||||
21
func/main.sh
21
func/main.sh
@@ -1561,9 +1561,16 @@ multiphp_count() {
|
|||||||
multiphp_versions() {
|
multiphp_versions() {
|
||||||
local -a php_versions_list
|
local -a php_versions_list
|
||||||
local php_ver
|
local php_ver
|
||||||
|
local php_type_internal=$(cat "$HESTIA/conf/hestia.conf" | grep "LOCAL_PHP" | grep "yes")
|
||||||
|
local pool_internal=""
|
||||||
if [ "$(multiphp_count)" -gt 0 ]; then
|
if [ "$(multiphp_count)" -gt 0 ]; then
|
||||||
for php_ver in $($BIN/v-list-sys-php plain); do
|
for php_ver in $($BIN/v-list-sys-php plain); do
|
||||||
[ ! -d "/etc/php/$php_ver/fpm/pool.d/" ] && continue
|
if [ -n "$php_type_internal" ]; then
|
||||||
|
pool_internal="/opt/brepo/php$php_ver/etc/php-fpm.d"
|
||||||
|
else
|
||||||
|
pool_internal="/etc/opt/remi/php$php_ver/php-fpm.d"
|
||||||
|
fi
|
||||||
|
[ ! -d "$pool_internal" ] && continue
|
||||||
php_versions_list+=($php_ver)
|
php_versions_list+=($php_ver)
|
||||||
done
|
done
|
||||||
echo "${php_versions_list[@]}"
|
echo "${php_versions_list[@]}"
|
||||||
@@ -1572,11 +1579,19 @@ multiphp_versions() {
|
|||||||
|
|
||||||
multiphp_default_version() {
|
multiphp_default_version() {
|
||||||
# Get system wide default php version (set by update-alternatives)
|
# Get system wide default php version (set by update-alternatives)
|
||||||
local sys_phpversion=$(php -r "echo substr(phpversion(),0,3);")
|
local sys_phpversion_l=$(php -r "echo substr(phpversion(),0,3);")
|
||||||
|
local sys_phpversion="${sys_phpversion_l//./}"
|
||||||
|
local php_type_internal=$(cat "$HESTIA/conf/hestia.conf" | grep "LOCAL_PHP" | grep "yes")
|
||||||
|
local pool_internal=""
|
||||||
|
if [ -n "$php_type_internal" ]; then
|
||||||
|
pool_internal="/opt/brepo/php$sys_phpversion/etc/php-fpm.d"
|
||||||
|
else
|
||||||
|
pool_internal="/etc/opt/remi/php$sys_phpversion/php-fpm.d"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if the system php also has php-fpm enabled, otherwise return
|
# Check if the system php also has php-fpm enabled, otherwise return
|
||||||
# the most recent php version which does have it installed.
|
# the most recent php version which does have it installed.
|
||||||
if [ ! -d "/etc/php/$sys_phpversion/fpm/pool.d/" ]; then
|
if [ ! -d "$pool_internal" ]; then
|
||||||
local all_versions="$(multiphp_versions)"
|
local all_versions="$(multiphp_versions)"
|
||||||
if [ -n "$all_versions" ]; then
|
if [ -n "$all_versions" ]; then
|
||||||
sys_phpversion="${all_versions##*\ }"
|
sys_phpversion="${all_versions##*\ }"
|
||||||
|
|||||||
Reference in New Issue
Block a user