I've got a very ugly page where I've had to set max timeout to 2 minutes in PHP for the moment. I'm using the set_time_limit()
function, but from the official documentation I wasn't clear how global the "setting" is.
This blurb seems to imply it's limited to the specific script:
The set_time_limit() function and the configuration directive max_execution_time only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real.
Basically I want to double check, setting this one-time in one script doesn't affect the max run time for any other script at all, does it? Running any other page will still have the default timeout? No other page (in fact no other function) requires this timeout.
The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php. ini . When called, set_time_limit() restarts the timeout counter from zero.
Maximum execution time (max_execution_time) is a time limit on how long a PHP script can run. It is a way hosting providers can limit the use and abuse of server resources, especially for shared hosting. The actual default value depends on the hosting, but it-s usually set to 30 (i.e. 30 seconds).
Yes, it is possible to set an infinite execution time for the PHP Script.
Only for the currently running script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With