Adjust php upload File size limit

Source: Internet
Author: User
Tags php file upload
    1. Max_execution_time = 30; Maximum execution time of each script, in seconds
    2. Max_input_time = 60; Maximum amount of time each script may spend parsing request data
    3. ; max_input_nesting_level = 64; Maximum input variable nesting level
    4. Memory_limit = 128M; Maximum amount of memory a script may consume (128MB)
    5. ; Maximum size of POST data that PHP would accept.
    6. Post_max_size = 105M
    7. ; Maximum allowed size for uploaded files.
    8. Upload_max_filesize = 100M
Copy Code

In general, when uploading a file, you first need to ensure that you upload memory, view php.ini default configuration, memory_limit default is 128M, the amount of memory that can be consumed in a script. If the upload limit is 100M, then this large amount of memory is sufficient (or generally, for example, multi-file upload may not be enough).

Second, adjust the execution time Set_time_limitmax_execution_time default setting is 30 seconds, for uploading 100M files, the current network situation, 30 seconds to upload 100M files is almost impossible, The 10M bandwidth is completely symmetrical, and a second and a trillion is 1.5. So this setting makes it difficult to estimate the actual execution time even if it is adjusted, and the adjustment is too long to be unfriendly to Apache. Therefore, it is recommended not to adjust the max_execution_time, but only in the PHP program: set_time_limit (0), to make temporary adjustments. Setting 0 means there is no time limit. Of course, from the point of view of program execution, set 0 is to solve the timeout problem, but in fact is not a good solution, if the program supports the continuation of the breakpoint, then set 600 seconds or 3,600 seconds also seems to be a better idea, time-out automatic breakpoint continued to pass.

third, restart Apache Server service httpd Restart you may be interested in the article: Breaking the PHP upload file size limit configuration method php increase file upload size limit how to cancel php file upload can not exceed the limit of 2M php file Upload size limit method to modify the php file upload size limit method

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.