Resolve NGINX+PHP-FPM cannot upload file problem

Source: Internet
Author: User
Tags file upload fpm ini memory usage php file php file upload

Solutions

Location ~. php$ {

Root/var/www/html/public;

Client_max_body_size 50M;

client_body_temp_path/tmp;

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param script_filename $document _root$fastcgi_script_name;

Include Fastcgi_params;

}

Attached: Do not find, the internet said a lot I have tried! has been prompted Firebug reached the Post request size limit

Modify Post_max_size upload_max_filesize max_execution_time max_input_time in php.ini

Open the php.ini file and reboot the server after the modifications are complete. Upload files under test .... (hehe, is it a big document?)

1, file upload the temporary directory of files. Must be a directory that can be written by the owner of the PHP process. If not specified, PHP uses the system defaults php.ini file in the temporary directory where Upload_tmp_dir is used to indicate the file placement of PHP uploads.

To upload files, make sure that the server does not close the temporary files and have write permissions on the folder

2, Max_execution_time

Variable Max_execution_time sets the time, in seconds, that PHP waits for the script to finish before the script is forced to terminate. This variable is useful when the script enters an infinite loop state. However, when there is a legitimate activity that takes a long time to complete (such as uploading a large file), this feature can also cause the operation to fail. In such cases you must consider increasing the value of this variable to avoid PHP shutting down the script while the script is performing some important process.

Modified to: Max_execution_time =800

3, File_uploads = On (originally asked to open do not have to set up)

4, Upload_max_filesize =2m modified to 800M

5. A variable associated with form submission is post_max_size, which controls the maximum amount of data that PHP can receive in a form submission that takes place in a post method. It seems unlikely that you will need to change the default 8 MB to a larger size. Instead, it should be appropriately reduced to a more realistic value. However, if you want to use the php file upload feature, you need to change this value to be larger than the upload_max_filesize.

Also modified to: Post_max_size =900m

6, Max_input_time

This variable can be limited in seconds to the time it takes to receive data by post, get, and put. If your application is running on a low speed link, you need to increase this value to accommodate the additional time required to receive data.

Modified to: Max_input_time =900

7, Memory_limit =10m

To avoid running scripts that use the system's available memory heavily, PHP allows you to define memory usage limits. Specify the maximum amount of memory that a single script can use by Memory_limit variables

Value of variable memory_limit (do not exceed server-inch maximum)

Modified to: Memory_limit =128m

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.