Internal Server Error due to set_time_limit in PHP -
i'm trying run following php script on shared hosting make run forever:
<?php ignore_user_abort(true); set_time_limit(0); include_once("function.php"); while (true) { if (file_exists("stop_test.txt")) { echo "break file exists!"; break; } // something, commenting section, face internal server error too! sleep(30); } exit(); ?>
but face "internal server error" after 1 minute. contacted hosting provider , asked them problem , have told me there no problem on server side , these kind of cron-like scripts allowed on shared hosting , suggested me review code.
i couldn't figure out why script results in internal server error, problem script?
i facing same issue, directly setting ini using ini_set()
seems have corrected issue:
ini_set('max_execution_time', 0);
however, suggested in comments, it's best practice set sane limit (30 seconds or so).
Comments
Post a Comment