且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

PHP上传大小及其对帖子大小和内存限制的影响

更新时间:2023-11-19 18:05:22


  1. post_max_size 应该是 3G


  2. upload_max_filesize 应该是 3G


  3. memory_limit 取决于!你将要做什么与文件。如果您要操作文件或执行其他内存密集型工作,则需要设置最高限制。如果您不想设置最大限制,则可以将其设置为 -1 。这个值并不是文件的大小,而是脚本处理作业所需的物理内存的大小。

对于前两个,它是您希望上传的最大文件大小,后面加上一个简短的字节值。对于 KB 应该是 K MB 应该是 G code>,...


My PHP web application requires files (about 2.5 to 3 GB in size) to be uploaded to the server. How will this impact on following directives ?

what are the required values in my case?

  • post_max_size
  • upload_max_filesize
  • memory_limit

Your help will greatly be appreciated.

  1. post_max_size should be 3G

  2. upload_max_filesize should be 3G

  3. memory_limit depends!!! what you are going to do with the file. If you are going to manipulate the file or do other memory intensive jobs, then you will need to set a high limit. If you don't want to put a maximum limit, you can always set it to -1. This value doesn't have to do much with the size of the file, but rather with the size of the physical memory your script needs to handle the job.

For the first two, it is the maximum file size you expect to be uploaded, suffixed with a short hand byte value. For KB should be K, MB should be M, GB should be G, ...