fix install script3

This commit is contained in:
Edmund Tan 2025-07-22 02:04:29 +08:00
parent f9cc99734f
commit eda574ce42
1 changed files with 9 additions and 8 deletions

View File

@ -144,14 +144,8 @@ install_web_server() {
# Determine required PHP packages # Determine required PHP packages
PHP_PACKAGES="php${PHP_VERSION} php${PHP_VERSION}-curl" PHP_PACKAGES="php${PHP_VERSION} php${PHP_VERSION}-curl"
# Check if json extension needs to be installed separately (older PHP versions) # JSON support is bundled in modern PHP versions (php-cli, php-fpm, etc.)
if apt-cache show "php${PHP_VERSION}-json" >/dev/null 2>&1 && \ log "INFO" "Skipping php${PHP_VERSION}-json as it's bundled in php${PHP_VERSION}-cli"
! 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
@ -364,6 +358,13 @@ test_installation() {
# Test PHP # Test PHP
if php -v > /dev/null 2>&1; then if php -v > /dev/null 2>&1; then
log "SUCCESS" "PHP is working" log "SUCCESS" "PHP is working"
# Test JSON support
if php -r 'var_dump(function_exists("json_encode"));' 2>/dev/null | grep -q "bool(true)"; then
log "SUCCESS" "PHP JSON support is available"
else
log "WARNING" "PHP JSON support may not be available"
fi
else else
log "ERROR" "PHP is not working" log "ERROR" "PHP is not working"
fi fi