Home  >  Article  >  Backend Development  >  Adjust PHP upload file size limit

Adjust PHP upload file size limit

WBOY
WBOYOriginal
2016-07-25 08:52:011241browse
  1. max_execution_time = 30 ; Maximum execution time of each script, in seconds
  2. max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
  3. ;max_input_nesting_level = 64 ; Maximum amount of memory a script may consume (128MB)
  4. ; Maximum size of POST data that PHP will accept.
  5. post_max_size = 105M
  6. ; Generally speaking, when uploading files, you first need to ensure the upload memory. Check the default configuration of PHP.INI. The default memory_limit is 128M, which is the amount of memory that can be consumed by executing a script. If the upload limit is 100M, then such a large amount of memory is enough (or generally speaking, for example, if multiple files are uploaded at the same time, it may not be enough).
  7. 2. Adjust the execution time set_time_limit
max_execution_time is set to 30 seconds by default. For uploading 100M files, judging from the current network conditions, it is almost impossible to upload 100M files in 30 seconds. The 10M bandwidth is completely symmetrical, and one megabyte per second takes one and a half minutes. . Therefore, even if this setting is adjusted, it is difficult to estimate the actual execution time, and if the adjustment is too long, it is not friendly to APACHE. Therefore, it is recommended not to adjust max_execution_time, but only use it in PHP programs: set_time_limit(0); Make temporary adjustments. Setting 0 means there is no time limit. Of course, from the perspective of program execution, setting 0 solves the timeout problem, but it is not actually a good solution. If the program supports breakpoint resuming, then setting 600 seconds or 3600 seconds seems to be a better idea, and the breakpoint will automatically break when the timeout occurs. Just resume the upload.
3. Restart the APACHE server
service httpd restart Articles you may be interested in:

Configuration method to break through the PHP upload file size limit

PHP increases file upload size limit How to cancel the restriction that PHP file upload cannot be larger than 2M

How to break through the PHP file upload size limit How to modify the upload size limit of php files

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn