This article describes how to modify the size limit of php files to be uploaded in nginx and php environments. this solution cannot exceed 2 MB for php files to be uploaded. For more information, see. When uploading files in php, first modify the settings of php. ini, and then change the server environment (using nginx + php). it is found that files with a relatively large size cannot be uploaded. The reason is that the client_max_body_size option value of nginx causes 413 errors. Problem Description: In the php. ini configuration file, upload_max_filesize is set to 50Mpost_max_size and the value is 413 MB. However, if the file uploaded exceeds 10 MB, the uploaderror error is returned. Server environment: centos5.7 32-bit nginx1.0.8php5.2.17 Solution: 1. if the file upload limit is 50 MB, modify php first. ini upload_max_filesize 50Mpost_max_size 100 M 2. modify the nginx configuration file: The default value of this configuration option is 1 m, which can be increased to 8 M to increase the file size limit. You can directly change it to 100 here. you can set it based on your needs. (Reference: the client_max_body_size must be the same as the maximum values in upload_max_filesize and post_max_size in php. ini, or slightly larger. this will not cause errors due to inconsistent size of submitted data .) Client_max_body_size 100 m; Summary In the case of the limit on the size of php files to be uploaded, in addition to the php configuration, the current server environment factors, such as the configuration items in nginx or apache, should also be considered. |