|
2 | 2 | ################################################################################## |
3 | 3 | # <START METADATA> |
4 | 4 | # @file_name: vstacklet-server-stack.sh |
5 | | -# @version: 3.1.2177 |
| 5 | +# @version: 3.1.2180 |
6 | 6 | # @description: Lightweight script to quickly install a LEMP stack with Nginx, |
7 | 7 | # Varnish, PHP7.4/8.1/8.3 (PHP-FPM), OPCode Cache, IonCube Loader, MariaDB, Sendmail |
8 | 8 | # and more on a fresh Ubuntu 20.04/22.04 or Debian 11/12 server for |
@@ -483,17 +483,19 @@ vstacklet::args::process() { |
483 | 483 | if [[ -n ${domain_ssl} ]]; then |
484 | 484 | # @script-note: check if nginx and/or php is installed |
485 | 485 | nginx_installed=$(dpkg-query -W -f='${Status}' nginx 2>/dev/null | grep -c "ok installed") |
486 | | - php_installed=$(ls -d /etc/php/* 2>/dev/null | wc -l) |
| 486 | + php_installed=$(find /etc/php -maxdepth 1 -type d -name "*" | wc -l) |
487 | 487 | [[ -z ${email} ]] && vstacklet::shell::text::error "please provide an email address with \`-e\`." && exit 1 |
488 | 488 | [[ -z ${nginx} && ${nginx_installed} -eq 0 ]] && vstacklet::shell::text::error "nginx is required to install an SSL certificate. please install nginx with \`-nginx\`." && exit 1 |
489 | 489 | [[ -z ${php} && ${php_installed} -eq 0 ]] && vstacklet::shell::text::error "php is required to install an SSL certificate. please install php with \`-php \"7.4\"\`, \`-php \"8.1\"\` or \`-php \"8.3\"\`." && exit 1 |
490 | 490 | fi |
491 | | - [[ ${php} == *"7"* ]] && declare -g php="7.4" |
492 | | - [[ ${php} == *"8.1"* ]] && declare -g php="8.1" |
493 | | - [[ ${php} == *"8.3"* ]] && declare -g php="8.3" |
494 | | - declare -a allowed_php=("7.4" "8.1" "8.3") |
495 | | - if ! vstacklet::array::contains "${php}" "supported php versions" ${allowed_php[@]}; then |
496 | | - vstacklet::shell::text::error "please provide a valid php version. supported versions are: ${allowed_php[*]}" && exit 1 |
| 491 | + if [[ ${php_installed} -eq 0 ]]; then |
| 492 | + [[ ${php} == *"7"* ]] && declare -g php="7.4" |
| 493 | + [[ ${php} == *"8.1"* ]] && declare -g php="8.1" |
| 494 | + [[ ${php} == *"8.3"* ]] && declare -g php="8.3" |
| 495 | + declare -a allowed_php=("7.4" "8.1" "8.3") |
| 496 | + if ! vstacklet::array::contains "${php}" "supported php versions" ${allowed_php[@]}; then |
| 497 | + vstacklet::shell::text::error "please provide a valid php version. supported versions are: ${allowed_php[*]}" && exit 1 |
| 498 | + fi |
497 | 499 | fi |
498 | 500 | [[ ${#invalid_option[@]} -gt 0 ]] && vstacklet::shell::text::error "invalid option(s): ${invalid_option[*]}" && exit 1 |
499 | 501 | # @script-note: set default arguments on options |
|
0 commit comments