本文介绍了Nginx PHP上传进度正常吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Nginx中上载是众所周知的事实,服务器将填充缓冲区,然后将文件发送到PHP.

It is a known fact with uploads in Nginx the server fills the buffer and then sends the file to PHP.

这通常意味着PHP的上传进度永远无法正常工作(更不用说fcgi了),但是,我刚刚升级到了Nginx的1.4.4版本,并且...工作正常.

This normally means that upload progress for PHP never worked (not to mention fcgi) however, I have just upgraded to version 1.4.4 of Nginx and it...well, works.

PHP能够跟踪上传.我测试了几次以确保结果.

PHP is able to keep track of the upload. I tested it a couple of times to make sure.

如果我理解正确,这可能意味着我不再能获得Nginx在文件上传中为我带来的好处(例如异步IO),或者我错了,在这方面是否取得了一些进展?

If I understand it correctly this might mean that I am no longer receiving the benefits that Nginx would give me in file uploads (such as async IO) or am I wrong, has there been some progress on this front?

推荐答案

好的,我确定我确实知道答案,而且非常简单.

Ok I recon I actually know the answer and it is quite simple.

Nginx在没有可以安装的上传模块的情况下,将尝试将其缓冲在内存中.为进程分配的内存用完后,实际上会将其转储到PHP进程.

Nginx, without the upload modules you can install, will try and buffer it in memory. When the allocated memory for its process is used up it will actually dump that to a PHP process.

这是PHP可以理解上传进度等的时候,这是Nginx无法再将整个文件保存在内存中的时候.

It is at this time that PHP can understand upload progress etc, is when Nginx can only no longer hold the entire file in memory.

这篇关于Nginx PHP上传进度正常吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 09:28
查看更多