correction

This commit is contained in:
2025-03-23 21:29:09 +01:00
parent 1b7173b824
commit ca73246a47
3 changed files with 54 additions and 18 deletions

View File

@@ -43,11 +43,47 @@ PHP_VERSION="8.3"
# Vérification de l'installation de PHP
echo -e "${YELLOW}Installation de PHP $PHP_VERSION et des modules courants...${RESET}"
apt install -y php$PHP_VERSION php$PHP_VERSION-cli php$PHP_VERSION-fpm \
php$PHP_VERSION-mysql php$PHP_VERSION-curl php$PHP_VERSION-gd \
php$PHP_VERSION-mbstring php$PHP_VERSION-xml php$PHP_VERSION-zip \
php$PHP_VERSION-bcmath php$PHP_VERSION-soap php$PHP_VERSION-intl \
php$PHP_VERSION-readline php$PHP_VERSION-ldap php$PHP_VERSION-imagick || { echo -e "${RED}Échec de l'installation de PHP${RESET}"; exit 1; }
# Base des modules PHP à installer
PHP_MODULES=(
php${PHP_VERSION}
php${PHP_VERSION}-cli
php${PHP_VERSION}-fpm
php${PHP_VERSION}-curl
php${PHP_VERSION}-gd
php${PHP_VERSION}-mbstring
php${PHP_VERSION}-xml
php${PHP_VERSION}-zip
php${PHP_VERSION}-bcmath
php${PHP_VERSION}-soap
php${PHP_VERSION}-intl
php${PHP_VERSION}-readline
php${PHP_VERSION}-ldap
php${PHP_VERSION}-imagick
php${PHP_VERSION}-exif
php${PHP_VERSION}-gmp
php${PHP_VERSION}-apcu
php${PHP_VERSION}-opcache
)
# Vérification MySQL / MariaDB
if dpkg -l | grep -qE 'mysql-server|mariadb-server'; then
echo -e "${GREEN}MySQL/MariaDB détecté. Ajout du module php-mysql.${RESET}"
PHP_MODULES+=(php${PHP_VERSION}-mysql)
fi
# Vérification PostgreSQL
if dpkg -l | grep -q postgresql; then
echo -e "${GREEN}PostgreSQL détecté. Ajout du module php-pgsql.${RESET}"
PHP_MODULES+=(php${PHP_VERSION}-pgsql)
fi
# Installation des modules PHP
echo -e "${GREEN}Installation des modules PHP...${RESET}"
apt install -y "${PHP_MODULES[@]}" || {
echo -e "${RED}❌ Échec de l'installation de PHP ou des modules.${RESET}"
exit 1
}
# Vérification si Apache est installé et installation du module PHP si nécessaire
if systemctl list-units --type=service --all | grep -q "apache2.service"; then