This is not one of the regular questions if sleep is being calculated for a timeout or similar material. Ok, here is the problem: I set max_execution_time for PHP as 15 seconds, and ideally this should be the timeout when it crosses the set limit, but it is not. Apache was restarted after changing the php.ini file, and ini_get (max_execution_time) - everything is in order. Sometimes the script runs up to 200 seconds, which is crazy. I have no connection to the database at all. The entire script searches for files in the unix file system and in some cases redirects them to another JSP page. There is no sleep mode () on the script.
I calculate the total runtime of a PHP script as follows:
At the beginning of the script, I installed:
$_mtime = microtime();
$_mtime = explode(" ",$_mtime);
$_mtime = $_mtime[1] + $_mtime[0];
$_gStartTime = $_mtime;
and the end time ($ _ gEndTime) is calculated similarly.
The total time is calculated in the stop function that I registered:
register_shutdown_function('shutdown');
.............
function shutdown()
{
..............
..............
$_total_time = $_gEndTime - $_gStartTime;
..............
switch (connection_status ())
{
case CONNECTION_NORMAL:
....
break;
....
case CONNECTION_TIMEOUT:
....
break;
......
}
}
Note: I cannot use $ _SERVER ['REQUEST_TIME'] because my version of PHP is incompatible. It sucks, I know.
1) Well, probably, my first question is why does my PHP script run even after the timeout limit is set?
2) Apache has a Timeout directive that is 300 seconds, but the PHP binary does not read the Apache configuration, and this should not be a problem.
3) Is there any chance that something will put PHP into sleep mode?
4) Am I calculating runtime incorrectly? Is there a better way to do this?
I'm at a dead end now. PHP Wizards - please help.
:
, . script, . . . Real max_execution_time PHP Linux, , . ?