PHP and Nginx file upload size limits how to resolve

Source: Internet
Author: User
    1. # Pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

    2. #
    3. Location ~ \.php$ {
    4. Root/home/www/htdocs;
    5. Fastcgi_pass 127.0.0.1:9000;
    6. Fastcgi_index index.php;
    7. Fastcgi_param Script_filename/home/www/htdocs$fastcgi_script_name;
    8. Includefastcgi_params;

    9. Client_max_body_size 35m; #客户端上传文件大小设为35M

    10. Client_body_temp_path/home/www/nginx_temp; #设置临时目录
    11. }

Copy Code

2, modify php.ini in the php.ini view:

    1. Upload_max_filesize = 8M
    2. Post_max_size = 10M
    3. Memory_limit = 20M
    4. max_execution_time=300
    5. File_uploads = On
Copy Code

HTTP file uploads are allowed by default, and this option cannot be set to OFF. Upload_tmp_dir =/tmp/www

When uploading large files, there will be slow upload feeling, when more than a certain time, will report the script to execute more than 30 seconds of error, modify the changes in the php.ini configuration file max_execution_time configuration options, which represents the maximum allowable execution time per script (in seconds), 0 means there is no limit.

The value of the max_execution_time can be adjusted appropriately and is not recommended to be set to 0.

Complete the above two changes, basically can solve the PHP upload file size limit problem.

  • 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.