私はエラーを排除する方法を見つけましたが、問題を解消しているのか、それとも単にマスキングしているのかは、すべての賭けが解除されています。私はいくつかのコンテナを実行しているものもあれば、この問題があるものもあれば、そうでないものもあります。エラーが発生します
は/ usr/libに/ PHP5/sessioncleanは次のとおりです。
#!/bin/sh -e
SAPIS="apache2:apache2\napache2filter:apache2\ncgi:php5\nfpm:php5-fpm\n"
# Iterate through all web SAPIs
(
printf "$SAPIS" | { \
proc_names=""
while IFS=: read -r conf_dir proc_name; do
if [ -e /etc/php5/${conf_dir}/php.ini ]; then
# Get all session variables once so we don't need to start PHP to get each config option
session_config=$(php5 -c /etc/php5/${conf_dir}/php.ini -d "error_reporting='~E_ALL'" -r 'foreach(ini_get_all("session") as $k => $v) echo "$k=".$v["local_value"]."\n";')
save_handler=$(echo "$session_config" | sed -ne 's/^session\.save_handler=\(.*\)$/\1/p')
save_path=$(echo "$session_config" | sed -ne 's/^session\.save_path=\(.*\)$/\1/p')
gc_maxlifetime=$(($(echo "$session_config" | sed -ne 's/^session\.gc_maxlifetime=\(.*\)$/\1/p')/60))
if [ "$save_handler" = "files" -a -d "$save_path" ]; then
proc_names="$proc_names $proc_name";
printf "%s:%s\n" "$save_path" "$gc_maxlifetime"
fi
fi
done
# first find all open session files and touch them (hope it's not massive amount of files)
for pid in $(pidof $proc_names); do
find "/proc/$pid/fd" -ignore_readdir_race -lname "$save_path/sess_\*" -exec touch -c {} \;
done
}) | sort -rn -t: -k2,2 | sort -u -t: -k 1,1 | while IFS=: read -r save_path gc_maxlifetime; do
# find all files older then maxlifetime and delete them
find -O3 "$save_path" -depth -mindepth 1 -name 'sess_*' -ignore_readdir_race -type f -cmin "+$gc_maxlifetime" -delete
done
exit 0
しかし、私はしていませんコンテナからそのワット/は/ usr/libに/ PHP5/sessioncleanを交換する場合
#!/bin/sh -e
SAPIS="apache2:apache2\napache2filter:apache2\ncgi:php5\nfpm:php5-fpm\n"
# Iterate through all web SAPIs
(
proc_names=""
printf "$SAPIS" | \
while IFS=: read -r conf_dir proc_name; do
if [ -e /etc/php5/${conf_dir}/php.ini ]; then
# Get all session variables once so we don't need to start PHP to get each config option
session_config=$(php5 -c /etc/php5/${conf_dir}/php.ini -d "error_reporting='~E_ALL'" -r 'foreach(ini_get_all("session") as $k => $v) echo "$k=".$v["local_value"]."\n";')
save_handler=$(echo "$session_config" | sed -ne 's/^session\.save_handler=\(.*\)$/\1/p')
save_path=$(echo "$session_config" | sed -ne 's/^session\.save_path=\(.*\)$/\1/p')
gc_maxlifetime=$(($(echo "$session_config" | sed -ne 's/^session\.gc_maxlifetime=\(.*\)$/\1/p')/60))
if [ "$save_handler" = "files" -a -d "$save_path" ]; then
proc_names="$proc_names $proc_name";
printf "%s:%s\n" "$save_path" "$gc_maxlifetime"
fi
fi
done
# first find all open session files and touch them (hope it's not massive amount of files)
for pid in $(pidof $proc_names); do
find "/proc/$pid/fd" -ignore_readdir_race -lname "$save_path/sess_\*" -exec touch -c {} \;
done
) | sort -rn -t: -k2,2 | sort -u -t: -k 1,1 | while IFS=: read -r save_path gc_maxlifetime; do
# find all files older then maxlifetime and delete them
find -O3 "$save_path" -depth -mindepth 1 -name 'sess_*' -ignore_readdir_race -type f -cmin "+$gc_maxlifetime" -delete
done
exit 0
次にエラーは発生しません。
これをホストしているマシンを再起動しようとしましたか? ;) 'session.save_path'設定のパスも確認できますか? –
sessioncleanは、既存のPHPプロセス以外のセッションを更新しようとします。おそらく、マシンを再起動するか、少なくともPHPのプロセス情報を更新するためにApacheを再起動する必要があります。 – maxhb
再起動が役立たない。セッションsave_pathは次のように設定されています:/ var/lib/php5/sessions これらのエラーは毎回発生しません(sessioncleanは30分ごとに実行され、このエラーは数日に数回表示されることがあります。 これに加えて、ほとんどのスクリプトではカスタムセッションハンドラを使用しています。つまり、セッションフォルダはほとんど常に空です。 –