Added fixes for php manipulation and system config
This commit is contained in:
@@ -22,6 +22,7 @@ source_conf "$HESTIA/conf/hestia.conf"
|
|||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Ensure that quota kernel modules are installed
|
# Ensure that quota kernel modules are installed
|
||||||
|
if [ ! -f /etc/redhat-release ]; then
|
||||||
kernel_module_check=$(find /lib/modules/$(uname -r) -type f -name '*quota_v*.ko*' | egrep '.*' && [ $? -eq 0 ])
|
kernel_module_check=$(find /lib/modules/$(uname -r) -type f -name '*quota_v*.ko*' | egrep '.*' && [ $? -eq 0 ])
|
||||||
if [ -z "$kernel_module_check" ]; then
|
if [ -z "$kernel_module_check" ]; then
|
||||||
# Install kernel modules for quota support.
|
# Install kernel modules for quota support.
|
||||||
@@ -31,6 +32,7 @@ if [ -z "$kernel_module_check" ]; then
|
|||||||
apt-get -qq install linux-image-extra-virtual -y
|
apt-get -qq install linux-image-extra-virtual -y
|
||||||
check_result $? "kernel module installation failed" "$E_UPDATE"
|
check_result $? "kernel module installation failed" "$E_UPDATE"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Checking quota package
|
# Checking quota package
|
||||||
quota=$(which --skip-alias --skip-functions quota 2> /dev/null)
|
quota=$(which --skip-alias --skip-functions quota 2> /dev/null)
|
||||||
|
|||||||
@@ -38,7 +38,11 @@ if [ -z "$WEB_BACKEND" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set file locations
|
# Set file locations
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
php_fpm="/usr/lib/systemd/system/php$version-php-fpm.service"
|
||||||
|
else
|
||||||
php_fpm="/etc/init.d/php$version-fpm"
|
php_fpm="/etc/init.d/php$version-fpm"
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify php version format
|
# Verify php version format
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ -f /etc/redhat-release ]; then
|
||||||
@@ -139,6 +143,13 @@ if [ ! -f "$php_fpm" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f '/etc/redhat-release' ]; then
|
||||||
|
result_alt_php=$(alternatives --display php | grep /usr/bin/php$version)
|
||||||
|
if [ -z "$result_alt_php" ]; then
|
||||||
|
alternatives --install /usr/bin/php php /usr/bin/php$version 1 > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if required modules for apache2 are enabled
|
# Check if required modules for apache2 are enabled
|
||||||
if [ "$WEB_SYSTEM" = "apache2" ]; then
|
if [ "$WEB_SYSTEM" = "apache2" ]; then
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
|||||||
@@ -21,11 +21,19 @@ source_conf "$HESTIA/conf/hestia.conf"
|
|||||||
check_args '1' "$#" 'VERSION'
|
check_args '1' "$#" 'VERSION'
|
||||||
|
|
||||||
# Verify php version format
|
# Verify php version format
|
||||||
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
if [[ ! $version =~ ^[0-9][0-9]+ ]]; then
|
||||||
|
echo "The specified PHP version format is invalid, it should look like [0-9][0-9]."
|
||||||
|
echo "Example: 70, 74, 80"
|
||||||
|
exit "$E_INVALID"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [[ ! $version =~ ^[0-9].[0-9]+ ]]; then
|
||||||
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
|
echo "The specified PHP version format is invalid, it should look like [0-9].[0-9]."
|
||||||
echo "Example: 7.0, 7.4, 8.0"
|
echo "Example: 7.0, 7.4, 8.0"
|
||||||
exit "$E_INVALID"
|
exit "$E_INVALID"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Check if php version exists
|
# Check if php version exists
|
||||||
version_check=$($BIN/v-list-sys-php plain | grep "$version")
|
version_check=$($BIN/v-list-sys-php plain | grep "$version")
|
||||||
@@ -42,10 +50,19 @@ check_hestia_demo_mode
|
|||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|
||||||
# Set file locations
|
# Set file locations
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
php_fpm="/usr/lib/systemd/system/php$version-php-fpm.service"
|
||||||
|
else
|
||||||
php_fpm="/etc/init.d/php$version-fpm"
|
php_fpm="/etc/init.d/php$version-fpm"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
rm -f /etc/opt/remi/php*/php-fpm.d/www.conf
|
||||||
|
cp -f $HESTIA/install/rpm/php-fpm/www.conf /etc/opt/remi/php$version/php-fpm.d/www.conf
|
||||||
|
else
|
||||||
rm -f /etc/php/*/fpm/pool.d/www.conf
|
rm -f /etc/php/*/fpm/pool.d/www.conf
|
||||||
cp -f $HESTIA/install/deb/php-fpm/www.conf /etc/php/$version/fpm/pool.d/www.conf
|
cp -f $HESTIA/install/deb/php-fpm/www.conf /etc/php/$version/fpm/pool.d/www.conf
|
||||||
|
fi
|
||||||
|
|
||||||
for user in $($BIN/v-list-sys-users plain); do
|
for user in $($BIN/v-list-sys-users plain); do
|
||||||
$BIN/v-rebuild-web-domains "$user" 'no' > /dev/null 2>&1
|
$BIN/v-rebuild-web-domains "$user" 'no' > /dev/null 2>&1
|
||||||
@@ -58,6 +75,13 @@ $BIN/v-restart-web-backend
|
|||||||
$BIN/v-restart-web
|
$BIN/v-restart-web
|
||||||
$BIN/v-restart-proxy
|
$BIN/v-restart-proxy
|
||||||
|
|
||||||
|
if [ -f '/etc/redhat-release' ]; then
|
||||||
|
result_alt_php=$(alternatives --display php | grep /usr/bin/php$version)
|
||||||
|
if [ -z "$result_alt_php" ]; then
|
||||||
|
alternatives --install /usr/bin/php php /usr/bin/php$version 1 > /dev/null 2>&1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
update-alternatives --set php /usr/bin/php$version
|
update-alternatives --set php /usr/bin/php$version
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
|
|||||||
11
bin/v-check-rhel-utility
Executable file
11
bin/v-check-rhel-utility
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# info: Check rehel or not
|
||||||
|
# options: none
|
||||||
|
|
||||||
|
# example: v-check-rhel-utility
|
||||||
|
|
||||||
|
if [ -f '/etc/redhat-release' ]; then
|
||||||
|
echo -n "+"
|
||||||
|
else
|
||||||
|
echo -n "-"
|
||||||
|
fi
|
||||||
@@ -32,13 +32,25 @@ if [ -z "$WEB_BACKEND" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Set file locations
|
# Set file locations
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
php_fpm="/usr/lib/systemd/system/php$version-php-fpm.service"
|
||||||
|
else
|
||||||
php_fpm="/etc/init.d/php$version-fpm"
|
php_fpm="/etc/init.d/php$version-fpm"
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify php version format
|
# Verify php version format
|
||||||
if [[ ! $version =~ ^[0-9]\.[0-9]+ ]]; then
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
if [[ ! $version =~ ^[0-9][0-9]+ ]]; then
|
||||||
|
echo "The PHP version format is invalid, it should look like [0-9][0-9]."
|
||||||
|
echo "Example: 70, 74, 80"
|
||||||
|
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 "The PHP version format is invalid, it should look like [0-9].[0-9]."
|
||||||
echo "Example: 7.0, 7.4"
|
echo "Example: 7.0, 7.4, 8.0"
|
||||||
exit
|
exit "$E_INVALID"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove backend template
|
# Remove backend template
|
||||||
@@ -64,10 +76,25 @@ mph="php$version-common php$version-mbstring php$version-bcmath php$version-cli
|
|||||||
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
|
||||||
|
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-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-mbstring php$version-php-pspell php$version-php-readline"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check is version is 7.1 or below to add mcrypt
|
# Check is version is 7.1 or below to add mcrypt
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
if [[ $(echo "$version 72" | awk '{print ($1 < $2)}') == 1 ]]; then
|
||||||
|
mph="$mph php$version-php-mcrypt"
|
||||||
|
fi
|
||||||
|
else
|
||||||
if [[ $(echo "$version 7.2" | awk '{print ($1 < $2)}') == 1 ]]; then
|
if [[ $(echo "$version 7.2" | awk '{print ($1 < $2)}') == 1 ]]; then
|
||||||
mph="$mph php$version-mcrypt"
|
mph="$mph php$version-mcrypt"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Purge php packages
|
# Purge php packages
|
||||||
if [ -f '/etc/redhat-release' ]; then
|
if [ -f '/etc/redhat-release' ]; then
|
||||||
@@ -101,8 +128,24 @@ if [ -f "$php_fpm" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Cleanup php folder
|
# Cleanup php folder
|
||||||
|
if [ -f '/etc/redhat-release' ]; then
|
||||||
|
[[ -d /etc/opt/remi/php$version ]] && rm -rf "/etc/opt/remi/php$version"
|
||||||
|
else
|
||||||
[[ -d /etc/php/$version ]] && rm -rf "/etc/php/$version"
|
[[ -d /etc/php/$version ]] && rm -rf "/etc/php/$version"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f '/etc/redhat-release' ]; then
|
||||||
|
if [ "$WEB_BACKEND" = "php-fpm" ]; then
|
||||||
|
conf=$(find /etc/opt/remi/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 /etc/opt/remi/php$version/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/php* -name www.conf)
|
conf=$(find /etc/php* -name www.conf)
|
||||||
# Check if www.conf exists
|
# Check if www.conf exists
|
||||||
@@ -113,6 +156,7 @@ if [ "$WEB_BACKEND" = "php-fpm" ]; then
|
|||||||
$BIN/v-restart-web-backend
|
$BIN/v-restart-web-backend
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#----------------------------------------------------------#
|
#----------------------------------------------------------#
|
||||||
# Hestia #
|
# Hestia #
|
||||||
|
|||||||
@@ -67,10 +67,17 @@ csv_list() {
|
|||||||
|
|
||||||
declare -a versions
|
declare -a versions
|
||||||
# List through /etc/php
|
# List through /etc/php
|
||||||
|
if [ -f /etc/redhat-release ]; then
|
||||||
|
for version in /etc/opt/remi/php*/php-fpm.d/www.conf; do
|
||||||
|
ver=$(echo "$version" | awk -F"/" '{ print $5 }' | sed "s/php\([[:digit:]]\+\)/\1/g")
|
||||||
|
versions+=("$ver")
|
||||||
|
done
|
||||||
|
else
|
||||||
for version in /etc/php/*/fpm/pool.d/www.conf; do
|
for version in /etc/php/*/fpm/pool.d/www.conf; do
|
||||||
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
ver=$(echo "$version" | awk -F"/" '{ print $4 }')
|
||||||
versions+=("$ver")
|
versions+=("$ver")
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# Listing data
|
# Listing data
|
||||||
case $format in
|
case $format in
|
||||||
|
|||||||
@@ -1380,6 +1380,7 @@ if [ "$phpfpm" = "yes" ]; then
|
|||||||
systemctl enable php${php_v}-php-fpm --now >> $LOG
|
systemctl enable php${php_v}-php-fpm --now >> $LOG
|
||||||
check_result $? "php-fpm start failed"
|
check_result $? "php-fpm start failed"
|
||||||
# Set default php version to $php_v
|
# Set default php version to $php_v
|
||||||
|
alternatives --install /usr/bin/php php /usr/bin/php$php_v 1 > /dev/null 2>&1
|
||||||
alternatives --set php /usr/bin/php$php_v > /dev/null 2>&1
|
alternatives --set php /usr/bin/php$php_v > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,10 @@ exec(HESTIA_CMD . "v-list-web-templates-backend json", $output, $return_var);
|
|||||||
$backend_templates = json_decode(implode("", $output), true);
|
$backend_templates = json_decode(implode("", $output), true);
|
||||||
unset($output);
|
unset($output);
|
||||||
|
|
||||||
|
exec(HESTIA_CMD . "v-check-rhel-utility", $output, $return_var);
|
||||||
|
$is_rhel = str_contains(implode("", $output), "+");
|
||||||
|
unset($output);
|
||||||
|
|
||||||
$v_php_versions = [
|
$v_php_versions = [
|
||||||
"php-5.6",
|
"php-5.6",
|
||||||
"php-7.0",
|
"php-7.0",
|
||||||
@@ -40,6 +44,21 @@ $v_php_versions = [
|
|||||||
"php-8.1",
|
"php-8.1",
|
||||||
"php-8.2",
|
"php-8.2",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($is_rhel){
|
||||||
|
$v_php_versions = [
|
||||||
|
"php-56",
|
||||||
|
"php-70",
|
||||||
|
"php-71",
|
||||||
|
"php-72",
|
||||||
|
"php-73",
|
||||||
|
"php-74",
|
||||||
|
"php-80",
|
||||||
|
"php-81",
|
||||||
|
"php-82",
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
sort($v_php_versions);
|
sort($v_php_versions);
|
||||||
|
|
||||||
if (empty($backend_templates)) {
|
if (empty($backend_templates)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user