Increase max_execution_time in PHP?

后端 未结 4 1683
长发绾君心
长发绾君心 2020-11-27 17:25

I\'m trying to upload large files to my server (my server support post_max_size 192mb and max_execution_time 600 sec). When I upload 100mb files ex

相关标签:
4条回答
  • 2020-11-27 17:46

    Is very easy, this work for me:

    PHP:

    set_time_limit(300); // Time in seconds, max_execution_time
    

    Here is the PHP documentation

    0 讨论(0)
  • 2020-11-27 17:49

    Add this to an htaccess file:

    <IfModule mod_php5.c>
       php_value post_max_size 200M
       php_value upload_max_filesize 200M
       php_value memory_limit 300M
       php_value max_execution_time 259200
       php_value max_input_time 259200
       php_value session.gc_maxlifetime 1200
    </IfModule>
    

    Read more about those settings at:

    • https://www.php.net/manual/en/info.configuration.php

    • https://www.looklinux.com/how-to-set-php-maximum-execution-time-in-an-htaccess-file/

    0 讨论(0)
  • 2020-11-27 17:49

    Theres a setting max_input_time (on Apache) for many webservers that defines how long they will wait for post data, regardless of the size. If this time runs out the connection is closed without even touching the php.

    So your problem is not necessarily solvable with php only but you will need to change the server settings too.

    0 讨论(0)
  • 2020-11-27 17:50

    For increasing execution time and file size, you need to mention below values in your .htaccess file. It will work.

    php_value upload_max_filesize 80M
    php_value post_max_size 80M
    php_value max_input_time 18000
    php_value max_execution_time 18000
    
    0 讨论(0)
提交回复
热议问题