|
@@ -1,6 +1,9 @@
|
|
|
#!/bin/bash
|
|
#!/bin/bash
|
|
|
# info: add php fpm version
|
|
# info: add php fpm version
|
|
|
# options: VERSION
|
|
# options: VERSION
|
|
|
|
|
+# labels: hestia
|
|
|
|
|
+#
|
|
|
|
|
+# example: v-add-web-php 7.4
|
|
|
#
|
|
#
|
|
|
# The function checks and delete a fpm php version if not used by any domain.
|
|
# The function checks and delete a fpm php version if not used by any domain.
|
|
|
|
|
|
|
@@ -28,19 +31,20 @@ php_fpm="/etc/init.d/php$version-fpm"
|
|
|
|
|
|
|
|
# Verify php version format
|
|
# Verify php version format
|
|
|
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 specified PHP version format is invalid, it should look like [0-9].[0-9]."
|
|
|
|
|
+ echo "Example: 7.0, 7.4"
|
|
|
exit
|
|
exit
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Check if php version already exists
|
|
# Check if php version already exists
|
|
|
if [ -f "$php_fpm" ] && [ -f "$HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl" ]; then
|
|
if [ -f "$php_fpm" ] && [ -f "$HESTIA/data/templates/web/php-fpm/PHP-${version/\./_}.tpl" ]; then
|
|
|
- echo "Version already installed..."
|
|
|
|
|
|
|
+ echo "ERROR: Specified PHP version is already installed."
|
|
|
exit
|
|
exit
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
# Check if php version is supported
|
|
# Check if php version is supported
|
|
|
if [ ! -f "$HESTIA_INSTALL_DIR/multiphp/$WEB_SYSTEM/PHP-${version//.}.sh" ]; then
|
|
if [ ! -f "$HESTIA_INSTALL_DIR/multiphp/$WEB_SYSTEM/PHP-${version//.}.sh" ]; then
|
|
|
- echo "Version is currently not supported or does not exist..."
|
|
|
|
|
|
|
+ echo "ERROR: Specified PHP version is not supported or does not exist."
|
|
|
exit
|
|
exit
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
@@ -77,7 +81,7 @@ apt-get -y -qq -o Dpkg::Options::="--force-confold" install $mph > /dev/null 2>&
|
|
|
BACK_PID=$!
|
|
BACK_PID=$!
|
|
|
|
|
|
|
|
# Check if package installation is done, print a spinner
|
|
# Check if package installation is done, print a spinner
|
|
|
-echo "Install PHP-$version, please wait..."
|
|
|
|
|
|
|
+echo "Installing PHP-$version, please wait..."
|
|
|
spinner="/-\|"
|
|
spinner="/-\|"
|
|
|
spin_i=1
|
|
spin_i=1
|
|
|
while kill -0 $BACK_PID > /dev/null 2>&1 ; do
|
|
while kill -0 $BACK_PID > /dev/null 2>&1 ; do
|
|
@@ -90,7 +94,7 @@ echo
|
|
|
|
|
|
|
|
# Check if installation was sucessfully
|
|
# Check if installation was sucessfully
|
|
|
if [ ! -f "$php_fpm" ]; then
|
|
if [ ! -f "$php_fpm" ]; then
|
|
|
- echo "Installation failed, please run the following command manualy for debuging:"
|
|
|
|
|
|
|
+ echo "ERROR: Installation failed, please run the following command manually for debugging:"
|
|
|
echo "apt-get install $mph"
|
|
echo "apt-get install $mph"
|
|
|
fi
|
|
fi
|
|
|
|
|
|