Real solution to php file upload size limit problem (nginx+php) _php instance by modifying configuration

Source: Internet
Author: User
Tags php file upload
Max_execution_time =
Max_input_time = 600

I have already described how to solve the php file upload size limit problem under apache+php. Then for the nginx+php site, and apache+php How to solve the php file upload size limit problem is different is nginx itself limit, limit the size of the client upload file, here to Nginx as an example to explain how to solve the problem nginx+php.

1.nginx Configuration Item Modification

Modify the/usr/local/nginx/conf/nginx.conf file and look for Client_max_body_size to set the value that you want to set later. Like what:

Location ~ \.php$ {
root   /home/www/htdocs;
Fastcgi_pass www.169it.com;
Fastcgi_index index.php;
Fastcgi_param Script_filename/home/www/htdocs$fastcgi_script_name;
Include  Fastcgi_params;
Client_max_body_size 10m;
#客户端上传文件大小设为10M
client_body_temp_path/home/www/nginx_temp;
#设置临时目录
}

2.php Configuration Item Modification

It is also necessary to modify the Max_execution_time in the php.ini configuration file (the maximum time for PHP page execution), Max_input_time (Maximum time for PHP page to accept data), Memory_ Limit (maximum memory used for PHP pages), Upload_max_filesize, and post_max_size 5 parameters.

modifying php.ini configuration Files

Upload_max_filesize = 20M
post_max_size = 30M
memory_limit = 256M

If the file is too large, there will be a time problem, if necessary, make the following modifications:

Max_execution_time =
Max_input_time = 600

The above content is this article to everybody narrated about through the modification configuration solves the php file upload size limit problem (nginx+php), hoped everybody likes.

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.