Overview
Today encountered a problem, in the PHP program upload picture has the following error: http:413 Request Entity Too Large.
Development environment: CentOS + Nginx + PHP + MySql
Solution
To solve this problem, depending on the size of the uploaded data file, you need to adjust the configuration of PHP and Nginx related parameters.
Configure PHP
PHP default upload file size limit of 2M, if more than 2M you need to modify the PHP configuration file php.ini inside the parameters.
Copy Code code as follows:
Post_max_size = 8M (the maximum limit for form submissions, which is not to limit the size of an uploaded individual file, but to limit the data submitted by the entire form). )
Upload_max_filesize = 2M (maximum limit of individual files uploaded)
Need to guarantee post_max_size >= Upload_max_filesize, namely the former is not less than the latter.
Be sure to restart PHP-FPM after the modification.
Configure Nginx
In addition to modifying the PHP configuration, you also need to modify the Nginx configuration file nginx.conf.
Copy Code code as follows:
Client_max_body_size 30M;
30M can be uploaded according to the size of the file itself set.
Be sure to reload the Nginx (service nginx restart) after the modification.
Summarize
Today solved several small problems, each record ~ ~
No more progress, a little bit every day