Compare commits

...

2 Commits

13 changed files with 210 additions and 559 deletions

View File

@ -409,66 +409,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"

View File

@ -409,67 +409,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)"

View File

@ -409,66 +409,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"

View File

@ -447,66 +447,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud` CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud`
CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data` CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data`

View File

@ -446,14 +446,28 @@ if [[ "$PHP_ENGINE" = "FPM" ]] ; then
fi fi
if [[ -z "$PHP_VERSION" ]] ; then if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!" if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$" main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
echo "" echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .." echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo "" echo ""
echo "" echo ""
PHP_VERSION= PHP_VERSION=
@ -475,6 +489,7 @@ if [[ "$PHP_ENGINE" = "FPM" ]] ; then
done done
fi
fi fi
fi fi

View File

@ -446,14 +446,28 @@ if [[ "$PHP_ENGINE" = "FPM" ]] ; then
fi fi
if [[ -z "$PHP_VERSION" ]] ; then if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!" if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$" main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
echo "" echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .." echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo "" echo ""
echo "" echo ""
PHP_VERSION= PHP_VERSION=
@ -475,6 +489,7 @@ if [[ "$PHP_ENGINE" = "FPM" ]] ; then
done done
fi
fi fi
fi fi
@ -509,6 +524,8 @@ echo ""
echo -e " Webserver user.......................: $HTTP_USER" echo -e " Webserver user.......................: $HTTP_USER"
echo -e " Webserver group......................: $HTTP_GROUP" echo -e " Webserver group......................: $HTTP_GROUP"
echo "" echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo "" echo ""

View File

@ -101,9 +101,10 @@ DATABASE_NAME="ownCloud_test"
# - Credentials to access MySQL/MariaDB Database # - Credentials to access MySQL/MariaDB Database
# - # -
# - Example # - Example
# - mysql_credential_args="--login-path=local" # - MYSQL_CREDENTIALS="--login-path=local"
# - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default) # - MYSQL_CREDENTIALS="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
# - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf" # - MYSQL_CREDENTIALS="--defaults-file=/usr/local/mysql/sys-maint.cnf"
# - MYSQL_CREDENTIALS="-S/run/mysqld/mysqld.sock"
# - # -
MYSQL_CREDENTIALS="--login-path=local" MYSQL_CREDENTIALS="--login-path=local"

View File

@ -446,14 +446,28 @@ if [[ "$PHP_ENGINE" = "FPM" ]] ; then
fi fi
if [[ -z "$PHP_VERSION" ]] ; then if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!" if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$" main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo "" echo ""
echo -e "\033[32m--\033[m" echo -e "\033[32m--\033[m"
echo "" echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .." echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo "" echo ""
echo "" echo ""
PHP_VERSION= PHP_VERSION=
@ -475,10 +489,12 @@ if [[ "$PHP_ENGINE" = "FPM" ]] ; then
done done
fi
fi fi
fi fi
fi fi
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php" PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php"
elif [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then elif [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then

View File

@ -447,66 +447,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud` CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud`
CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data` CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data`

View File

@ -412,66 +412,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
echo "" echo ""
echo -e " \033[32m--\033[m" echo -e " \033[32m--\033[m"

View File

@ -412,66 +412,8 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
echo "" echo ""
echo -e " \033[32m--\033[m" echo -e " \033[32m--\033[m"

75
snippet-get-php-major-version Executable file
View File

@ -0,0 +1,75 @@
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
fi

View File

@ -500,67 +500,7 @@ fi
# Check PHP Version # Check PHP Version
# #
if [[ "$PHP_ENGINE" = "FPM" ]] ; then source ${script_dir}/snippet-get-php-major-version
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; then
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
fi
fi
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "The PHP version was not specified and cannot be determined!"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.0 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
# - Determin PHP binary # - Determin PHP binary