fix install script2
This commit is contained in:
parent
e3c897614f
commit
f9cc99734f
|
|
@ -141,9 +141,21 @@ install_web_server() {
|
||||||
# Update package list
|
# Update package list
|
||||||
apt update || error_exit "Failed to update package list"
|
apt update || error_exit "Failed to update package list"
|
||||||
|
|
||||||
|
# Determine required PHP packages
|
||||||
|
PHP_PACKAGES="php${PHP_VERSION} php${PHP_VERSION}-curl"
|
||||||
|
|
||||||
|
# Check if json extension needs to be installed separately (older PHP versions)
|
||||||
|
if apt-cache show "php${PHP_VERSION}-json" >/dev/null 2>&1 && \
|
||||||
|
! apt-cache show "php${PHP_VERSION}-json" 2>/dev/null | grep -q "virtual package"; then
|
||||||
|
PHP_PACKAGES="$PHP_PACKAGES php${PHP_VERSION}-json"
|
||||||
|
log "INFO" "Will install php${PHP_VERSION}-json separately"
|
||||||
|
else
|
||||||
|
log "INFO" "JSON support is included in main PHP package"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$WEB_SERVER" == "apache" ]]; then
|
if [[ "$WEB_SERVER" == "apache" ]]; then
|
||||||
# Install Apache and PHP
|
# Install Apache and PHP
|
||||||
apt install -y apache2 php${PHP_VERSION} php${PHP_VERSION}-curl php${PHP_VERSION}-json libapache2-mod-php${PHP_VERSION} || error_exit "Failed to install Apache and PHP"
|
apt install -y apache2 $PHP_PACKAGES libapache2-mod-php${PHP_VERSION} || error_exit "Failed to install Apache and PHP"
|
||||||
|
|
||||||
# Enable and start Apache
|
# Enable and start Apache
|
||||||
systemctl enable apache2 || error_exit "Failed to enable Apache"
|
systemctl enable apache2 || error_exit "Failed to enable Apache"
|
||||||
|
|
@ -153,7 +165,7 @@ install_web_server() {
|
||||||
|
|
||||||
elif [[ "$WEB_SERVER" == "nginx" ]]; then
|
elif [[ "$WEB_SERVER" == "nginx" ]]; then
|
||||||
# Install Nginx and PHP-FPM
|
# Install Nginx and PHP-FPM
|
||||||
apt install -y nginx php${PHP_VERSION}-fpm php${PHP_VERSION}-curl php${PHP_VERSION}-json || error_exit "Failed to install Nginx and PHP"
|
apt install -y nginx php${PHP_VERSION}-fpm $PHP_PACKAGES || error_exit "Failed to install Nginx and PHP"
|
||||||
|
|
||||||
# Enable and start services
|
# Enable and start services
|
||||||
systemctl enable nginx php${PHP_VERSION}-fpm || error_exit "Failed to enable Nginx and PHP-FPM"
|
systemctl enable nginx php${PHP_VERSION}-fpm || error_exit "Failed to enable Nginx and PHP-FPM"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue