From 59a0ed28f31ad88aec94911d27ec3433f80893b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 9 Feb 2012 00:24:21 +0100 Subject: [PATCH] Improve maxlifetime script to scan for more SAPIs and scan all *.ini in conf.d directory --- debian/maxlifetime | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/debian/maxlifetime b/debian/maxlifetime index 2a89134..d5a536b 100644 --- a/debian/maxlifetime +++ b/debian/maxlifetime @@ -2,16 +2,20 @@ max=1440 -if which php5 >/dev/null 2>&1 && [ -e /etc/php5/apache2/php.ini ]; then - cur=$(php5 -c /etc/php5/apache2/php.ini -d "error_reporting='E_ALL & ~E_DEPRECATED'" -r 'print ini_get("session.gc_maxlifetime");') - [ -z "$cur" ] && cur=0 - [ "$cur" -gt "$max" ] && max=$cur +if which php5 >/dev/null 2>&1; then + for sapi in apache2 apache2filter cgi fpm; do + if [ -e /etc/php5/${sapi}/php.ini ]; then + cur=$(php5 -c /etc/php5/${sapi}/php.ini -d "error_reporting='~E_ALL'" -r 'print ini_get("session.gc_maxlifetime");') + [ -z "$cur" ] && cur=0 + [ "$cur" -gt "$max" ] && max=$cur + fi + done else - for ini in /etc/php5/*/php.ini; do - cur=$(sed -n -e 's/^[[:space:]]*session.gc_maxlifetime[[:space:]]*=[[:space:]]*\([0-9]\+\).*$/\1/p' $ini 2>/dev/null || true); - [ -z "$cur" ] && cur=0 - [ "$cur" -gt "$max" ] && max=$cur - done + for ini in /etc/php5/*/php.ini /etc/php5/conf.d/*.ini; do + cur=$(sed -n -e 's/^[[:space:]]*session.gc_maxlifetime[[:space:]]*=[[:space:]]*\([0-9]\+\).*$/\1/p' $ini 2>/dev/null || true); + [ -z "$cur" ] && cur=0 + [ "$cur" -gt "$max" ] && max=$cur + done fi echo $(($max/60)) -- 1.7.2.5