Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP max_execution_time ignored (no safe mode, no shared host, just localhost/windows7/php 5.3.1 and Apache timeout is 300)

Tags:

php

This problem drives me nuts, because the max_execution_time in the php.ini and in the htaccess and reported from php is definitely higher, than reportet in the warning message.

<?php
echo "Max execution time: ".ini_get("max_execution_time")."<br />";
while(true)
{
    sleep(1);
}
?>

Output:

Max execution time: 240

Fatal error: Maximum execution time of 60 seconds exceeded in C:\xampp\htdocs\timetest.php on line 5

Answer

Yes, it seems to be a bug: max_input_time overwrites max_execution_time!

htaccess:

php_value max_execution_time 240
php_value max_input_time 111

timetest.php:

<?php
echo "Max execution time: ".ini_get("max_execution_time")."<br />";
echo "Max input time: ".ini_get("max_input_time")."<br />";
while(true)
{
    sleep(1);
}
?>

Output (proof):

Max execution time: 240

Max input time: 111

Fatal error: Maximum execution time of 111 seconds exceeded in C:\xampp\htdocs\timetest.php on line 6

Thanks for the help!

like image 845
Felix Avatar asked Mar 24 '10 09:03

Felix


1 Answers

It's a PHP bug. Reported here http://bugs.php.net/48949

Edit: Found that max_input_time over-writes the max_execution time. This must be the issue with you.

like image 129
pinaki Avatar answered Sep 28 '22 19:09

pinaki