In php.ini if we do not modify the post_max_size,upload_max_filesize these parameters, the default is to upload up to 2MB of files, if dozens of MB or more can not be uploaded, I would like to introduce a few ways to modify the PHP configuration file upload large files, I hope you have a little help
windows+apache+php Environment
The most common php upload file size limit in Apache is defined by the php.ini configuration file, and by modifying the values of the following three fields, re-enabling the server-side program (such as Apache), you can successfully modify the PHP upload file size limit:
Upload_max_filesize = 8M
Post_max_size = 10M
Memory_limit = 20M
The specific configuration is as follows
Look in the php.ini.
| The code is as follows |
Copy Code |
Max_execution_time |
The default is 30 seconds. Change to
| The code is as follows |
Copy Code |
Max_execution_time = 0 |
0 means no Limit
The above modification is the PHP upload file in the script execution timeout time
2. Modify Post_max_size to set the maximum allowable size for post data. This setting also affects the PHP upload file.
PHP default post_max_size is 2M. If the POST data size is larger than post_max_size $_post and $_files superglobals will be empty.
Find Post_max_size. instead
| The code is as follows |
Copy Code |
Post_max_size = 150M |
3. A lot of people will change the second step. However, PHP uploads a file at a maximum of 8M.
Why, we're going to change one. The parameter upload_max_filesize indicates the maximum size of the uploaded file.
Find Upload_max_filesize, default to 8M instead
| The code is as follows |
Copy Code |
Upload_max_filesize = 100M |
Also to explain is in the PHP file crosses, post_max_size greater than upload_max_filesize is better.
nginx+php Upload file size configuration modification
Before uploading files with PHP, first modify the settings of the php.ini, the previous days the server changed the environment (using nginx+php), today suddenly found a slightly larger file can not upload, tangled half a day, finally found is Nginx Client_max_body_ Size 413 error caused by configuration option value. Now share the process.
Problem Description:
Upload_max_filesize set to 50M in the php.ini configuration file
The value of the Post_max_size setting is 100M
However, uploading more than 10 megabytes of files will return a Uploaderror 413 error.
Server environment:
centos5.7 32-bit
nginx1.0.8
php5.2.17
Workaround:
1, if you upload a file limit of 50 trillion, then first modify Php.iniupload_max_filesize 50M
| The code is as follows |
Copy Code |
Post_max_size 100M |
2. Then modify the Nginx configuration file:
This configuration option value by default is 1m, can be increased to 8m to increase the file size limit, I directly modified here to 100, the situation can be set according to their own needs. (Reference: The client_max_body_size size is the same as or slightly larger than the maximum value in the Upload_max_filesize, post_max_size in the php.ini, so that there are no errors due to inconsistent size of the submitted data.) )
| The code is as follows |
Copy Code |
| Client_max_body_size 100m; |
http://www.bkjia.com/PHPjc/632790.html www.bkjia.com true http://www.bkjia.com/PHPjc/632790.html techarticle in php.ini If we do not modify the post_max_size,upload_max_filesize these parameters, the default is to upload up to 2MB of files, if dozens of MB or more can not be uploaded, the next ...