configuraiton des modules opcache et apcu
This commit is contained in:
@@ -97,6 +97,7 @@ fi
|
|||||||
|
|
||||||
# Configuration de PHP-FPM si ce n'est pas déjà fait
|
# Configuration de PHP-FPM si ce n'est pas déjà fait
|
||||||
PHP_INI="/etc/php/$PHP_VERSION/fpm/php.ini"
|
PHP_INI="/etc/php/$PHP_VERSION/fpm/php.ini"
|
||||||
|
PHP_INI_DIR="/etc/php/${PHP_VERSION}/fpm/conf.d"
|
||||||
|
|
||||||
if grep -q "memory_limit = 512M" "$PHP_INI"; then
|
if grep -q "memory_limit = 512M" "$PHP_INI"; then
|
||||||
echo -e "${GREEN}Configuration de PHP-FPM déjà optimisée.${RESET}"
|
echo -e "${GREEN}Configuration de PHP-FPM déjà optimisée.${RESET}"
|
||||||
@@ -111,6 +112,31 @@ else
|
|||||||
systemctl restart php$PHP_VERSION-fpm || { echo -e "${RED}Échec du redémarrage de PHP-FPM${RESET}"; exit 1; }
|
systemctl restart php$PHP_VERSION-fpm || { echo -e "${RED}Échec du redémarrage de PHP-FPM${RESET}"; exit 1; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Configuration OPCache
|
||||||
|
OPCACHE_INI="${PHP_INI_DIR}/10-opcache.ini"
|
||||||
|
cat > "$OPCACHE_INI" <<EOF
|
||||||
|
; Configuration OPcache optimisée
|
||||||
|
opcache.enable=1
|
||||||
|
opcache.memory_consumption=128
|
||||||
|
opcache.interned_strings_buffer=16
|
||||||
|
opcache.max_accelerated_files=10000
|
||||||
|
opcache.revalidate_freq=60
|
||||||
|
opcache.fast_shutdown=1
|
||||||
|
opcache.enable_cli=1
|
||||||
|
EOF
|
||||||
|
echo "==> Fichier $OPCACHE_INI mis à jour."
|
||||||
|
|
||||||
|
# Configuration APCu
|
||||||
|
APCU_INI="${PHP_INI_DIR}/20-apcu.ini"
|
||||||
|
cat > "$APCU_INI" <<EOF
|
||||||
|
; Configuration APCu optimisée
|
||||||
|
apc.enabled=1
|
||||||
|
apc.shm_size=64M
|
||||||
|
apc.ttl=7200
|
||||||
|
apc.enable_cli=0
|
||||||
|
EOF
|
||||||
|
echo "==> Fichier $APCU_INI mis à jour."
|
||||||
|
|
||||||
# Test de la configuration Apache
|
# Test de la configuration Apache
|
||||||
if systemctl is-active --quiet apache2; then
|
if systemctl is-active --quiet apache2; then
|
||||||
read -rp "Voulez-vous tester le support de PHP par Apache ? (o/n) : " test_php
|
read -rp "Voulez-vous tester le support de PHP par Apache ? (o/n) : " test_php
|
||||||
|
|||||||
Reference in New Issue
Block a user