PHPで言語処理のプログラムをガリガリ回そうと思ったら(ローカルで),「Maximum execution time of 60 seconds exceeded」と怒られた.
ようするに「処理時間が60秒を超えたから止めておいたよ!」というapacheの親切である.
解決策1.php.iniを書き換える
max_execution_time = 60 ; Maximum execution time of each script, in seconds
という記述があるので,ここを適当に変更すれば"Maximum execution time"が書き換わる.
apacheの再起動を忘れずに!
解決策2.set_time_limit関数を使う
set_time_limit
この関数で実行時間の最大値を制限することができる.
set_time_limit(20);
こんな感じで書くと,プログラム単位で"Maximum execution time"が変更される.
僕的にapache全体の"Maximum execution time"が書き換わるのは,よろしくないような気がしたので,今回はset_time_limit関数を使って解決した.