PHP file upload affected or not by max_input_time?

后端 未结 4 2022
情歌与酒
情歌与酒 2020-12-13 09:55

I\'m looking into what is the best value to set for defaults in PHP. I\'ve seen many contradicting points about max_input_time.

This answer says that h

4条回答
  •  青春惊慌失措
    2020-12-13 10:35

    After some quick benchmarking I do not believe max_input_time has any bearing on handling large uploads by users with slow connections.

    From http://us3.php.net/manual/en/info.configuration.php#ini.max-input-time

    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.

    I'm using PHP 5.3.8 and used the following .htaccess config

    php_value max_input_time 5
    php_value max_execution_time 1
    php_value upload_max_filesize "2048M"
    php_value post_max_size "2048M"
    

    My test script is:

    ';
        var_dump($_FILES);
        echo '
    '; } ?>
    File:

    With several trials my 1.5G file takes around 16-17 seconds to upload, 4-5 seconds to process, and execution time is essentially 0.

    With max_input_time 5 the script completes. With it set to 4 we get PHP Fatal error: Maximum execution time of 4 seconds exceeded in Unknown on line 0, referer: http://localhost/test-upload.php

    It also seems max_execution_time has no bearing since we kept it at 1 throughout the tests.

提交回复
热议问题