Nginx tips: PHP uploading progress bar – 0001

Time:2019-10-22

The official progress support of PHP is not applicable to nginx + PHP via fastcgi. For related articles, please refer to using session to track the upload progress. The last warning of this article indicates that nginx will handle the upload by itself, while PHP can only get one final result and cannot track the process. The last post (from S. zarges) gives the same warning. In this way, we have to find other ways, such as APC. Another option is nginx upload module.

About nginx upload module

This module was developed by vkholodkov five years ago and has not been updated for a long time. Its source code address. This is the document. Download the source code directly.
After downloading, unzip:

tar xvfz nginx_upload_module-2.0.11.tar.gz

Need to be patched

The code will last forever, bug will last forever. Over the years, a lot of code has become completely different. Many bugs have lost their original appearance, leaving only a mound of bugs to remind us of the glorious past. Now nginx has changed a lot compared to 5 years ago. For example, NGX HTTP read request body has deleted the to write member, which is required by nginx upload module. The result is that nginx upload module cannot be compiled. Please refer to this link for a discussion of this issue. We would like to thank this friend: davromaniak, who modified nginx upload module and corrected the error so that it can be compiled. This is his blog post on the revision of the problem. All we have to do is download his changes and patch nginx upload module.
The name of the downloaded patch file isdavromaniak.txt

Patch up

Use the following command:

CP darvromaniak.txt [directory of nginx [upload] module]
patch ngx_http_upload_module.c davromaniak.txt

Compiling modules into nginx

First download the nginx source code from this link. Then compile:

cd nginx-1.5.8
. / configure -- add module = [the directory of nginx ﹣ upload ﹣ module]
make
make install

After a short wait, the compilation and installation are complete, and you can restart nginx.


Be careful


I used the older nginx upload module (2.0). If you are using the new 2.2, please solve the problem yourself.

Recommended Today

CSS margin overlap and its prevention

The vertical adjacent boundaries of two or more block level boxes coincide. The resulting boundary width is the largest of the adjacent boundary widths. If a negative boundary appears, the negative boundary with the largest absolute value is subtracted from the maximum positive boundary. If there is no positive boundary, the negative boundary with the […]