Bug #73041 [Opn->Nab]: max_execution_time starts counting when file upload starts
Edit report at https://bugs.php.net/bug.php?id=73041&edit=1
ID: 73041
Updated by: ab@php.net
Reported by: mitenem at outlook dot com
Summary: max_execution_time starts counting when file upload
starts
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
Operating System: Windows
PHP Version: 7.0.10
Block user comment: N
Private report: N
New Comment:
Thanks for the report. It is not a bug. Ensuring the timeout setting is high enough is the way to
go. Turning off the time limit puts your site under security risk.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2016-09-07 16:03:31] mitenem at outlook dot com
Description:
------------
When I try to upload file and upload takes more than max_execution_time, PHP returns fatal error
maximum execution time was exceeded immediately after file is uploaded. Error is always thrown on
line in which first <?php or <? appears.
I use Apache 2.4.23 with PHP 7.0.10 as an module (tested on systems with both 32-bit and both
64-bit).
Apache configuration for PHP in httpd.conf:
LoadModule php7_module [...]/php/php7apache2_4.dll
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Various tested scenarios:
* max_execution_time = 30, max_input_time = -1
* uploaded 200 kB file: upload took about 5 seconds, no errors, successfully uploaded
* uploaded 3 MB file: upload took about 35 seconds, fatal error
* uploaded 8 MB file: upload took about 90 seconds, fatal error
* max_execution_time = 30, max_input_time = 300
* uploaded 200 kB file: upload took about 5 seconds, no errors, successfully uploaded
* uploaded 3 MB file: upload took about 35 seconds, fatal error
* uploaded 8 MB file: upload took about 90 seconds, fatal error
* max_execution_time = 300, max_input_time = 300
* uploaded 200 kB file: upload took about 5 seconds, no errors, successfully uploaded
* uploaded 3 MB file: upload took about 35 seconds, no errors, successfully uploaded
* uploaded 8 MB file: upload took about 90 seconds, no errors, successfully uploaded
Script below was tested without php.ini file.
Values returned by ini_get:
max_execution_time = 30
max_input_time = -1
Test script:
---------------
<!DOCTYPE html>
<html>
<body>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post"
enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" />
</form>
<?php print_r($_FILES); ?>
</body>
</html>
Expected result:
----------------
File should be normally uploaded and $_FILES should contain its data.
Actual result:
--------------
Fatal error: Maximum execution time of 30 seconds exceeded in [...]\test.php on line 4
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=73041&edit=1
Thread (2 messages)