问题
Say, I have PHP running on an Apache. When someone makes a client request (doesn't matter how), what defines the amount of time that the client will wait for, the script to run? Is this option of an Apache, of a PHP or is defined by the client himself? Also, what if the script is called via curl?
回答1:
See PHP set_time_limit()
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini.
Please note:
This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
You might also be interested in max_input_time (set via php.ini)
This sets the maximum time in seconds a script is allowed to parse input data, like POST and GET. It is measured from the moment of receiving all data on the server to the start of script execution.
回答2:
It's defined in php.ini, parameter is called max_execution_time.
You can change it with set_time_limit, ini_set OR in php.ini directly.
But, in fact you are asking about
the amount of time that the client will wait for, the script to run
and imho, it is infinite. I have never seen such a moment when server was running script and browser refused to wait. The main is to keep script running on server.
来源:https://stackoverflow.com/questions/13572099/what-defines-the-timeout-period-in-php