définir la timezone

This commit is contained in:
2025-04-05 06:23:52 +02:00
parent b75afa7df8
commit 1b758b6161
3 changed files with 28 additions and 3 deletions

View File

@@ -20,6 +20,8 @@ apt update && apt upgrade -y || { echo -e "${RED}Échec de la mise à jour des p
VERSION=$(lsb_release -sc)
SUPPORTED_VERSIONS=("buster" "bullseye" "bookworm")
TIMEZONE=$(timedatectl show --value --property=Timezone)
if [[ ! " ${SUPPORTED_VERSIONS[@]} " =~ " ${VERSION} " ]]; then
echo -e "${RED}Version de Debian non supportée : $VERSION${RESET}"
exit 1
@@ -41,6 +43,9 @@ fi
# Définition de la version PHP souhaitée
PHP_VERSION="8.3"
PHP_INI_CLI="/etc/php/${PHP_VERSION}/cli/php.ini"
PHP_INI_APACHE="/etc/php/${PHP_VERSION}/apache2/php.ini"
# Vérification de l'installation de PHP
echo -e "${YELLOW}Installation de PHP $PHP_VERSION et des modules courants...${RESET}"
@@ -137,6 +142,10 @@ apc.enable_cli=0
EOF
echo "==> Fichier $APCU_INI mis à jour."
# Définir la timezone PHP pour CLI et Apache
sed -i "s|^;*date.timezone =.*|date.timezone = ${TIMEZONE}|" "${PHP_INI_CLI}"
sed -i "s|^;*date.timezone =.*|date.timezone = ${TIMEZONE}|" "${PHP_INI_APACHE}"
# Test de la configuration Apache
if systemctl is-active --quiet apache2; then
read -rp "Voulez-vous tester le support de PHP par Apache ? (o/n) : " test_php