# Nginx + PHP Windows Network Sharing Uploads locking/slow load time

**URL:** <https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646>\
**Category:** NGINX\
**Created:** [July 10, 2015, 8:35pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646 "2015-07-10T20:35:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [July 10, 2015, 8:35pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/1 "2015-07-10T20:35:00Z")

</div>

So i have Nginx as a web server with PHP running as fastcgi what nginx  
serves traffic via upstreams.

The strange bug i have encountered is the fact when i upload a large  
file  
lets say 2GB and PHP must pass this file to a mapped hard drive via  
network  
sharing. PHP/Nginx does not serve traffic to anyone until that  
temp(uploaded  
file) has been successfully moved to the mapped hard drive.

Does anyone know why it would be locking up like this or how to solve it  
? I  
don’t think it is Nginx i think it is just PHP that is locking up. But  
it is  
a nightmare trying to figure out how to keep it serving traffic since  
there  
will be 60-120 seconds while PHP is pushing this file to the mapped hard  
drive that no traffic gets served and everyones pages keep loading (they  
don’t time out just keep loading / waiting for first byte what is always  
sent as soon as the file upload is complete.)

If it helps its latest php builds default production config and  
itpp2012’s  
Nginx Build.

Posted at Nginx Forum:

> **[Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260193#msg-260193)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 10, 2015, 9:07pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/2 "2015-07-10T21:07:08Z")

</div>

There is a no\_buffer option for proxy you could try (see regular manual  
for  
correct function name).

Posted at Nginx Forum:

> **[Re: Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260194#msg-260194)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 10, 2015, 9:17pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/3 "2015-07-10T21:17:39Z")

</div>

Hi itpp2012 thanks for the swift response :), I am not proxying to PHP  
Nginx  
passes the request to the fastcgi upstream Nginx + PHP are both on the  
same  
machine just the storage machine (the mapped hard drive) is seperate.

I did look in the docs and find this “fastcgi\_buffering off;” And  
“proxy\_buffering off;”  
[http://nginx.org/en/docs/http/ngx\_http\_fastcgi\_module.html#fastcgi\_buffering](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffering)  
[http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html#proxy\_buffering](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_buffering)

Is that what you are referring to ?

I will give a go with those directives and reply back if it is fixed or  
not.

Posted at Nginx Forum:

> **[Re: Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260196#msg-260196)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 10, 2015, 10:21pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/4 "2015-07-10T22:21:55Z")

</div>

Those directives did not fix it.

But i decided to investigate sessions and temporary upload directory of  
PHP.  
Now the temporary session directory gave me the same no loading issue  
until  
uploads have been moved to the mapped hard drive by php.

But the following seemed to change that and actualy allow me to keep  
serving  
traffic with uploads being pushed to the mapped hard drive.

Inside PHP.INI  
[PATH=C:/server/websites/public\_www]  
upload\_tmp\_dir=Z:/server/websites/temp-uploads

C:/ is the local machine drive where nginx + php is presant.  
Z:/ is the external mapped hard drive.

Now i don’t know why that seems to fix it perhaps someone can elaborate  
?

Also it comes at a cost it takes twice as long for a upload to be pushed  
to  
a mapped hard drive for some reason like that.

Posted at Nginx Forum:

> **[Re: Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260202#msg-260202)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 10, 2015, 9:48pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/5 "2015-07-10T21:48:36Z")

</div>

## c0nw0nk Wrote:

> I did look in the docs and find this “fastcgi\_buffering off;” And  
> “proxy\_buffering off;”
> 
> Is that what you are referring to ?

Yea thats it, I knew they were there but couldn’t remember them as fast.

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,260193,260197#msg-260197](http://forum.nginx.org/read.php?2,260193,260197#msg-260197)

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 10, 2015, 10:41pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/6 "2015-07-10T22:41:11Z")

</div>

Sounds like a blocking disk driver issue, look at the driver settings,  
dma/pio/caching/advanced sata/etc…  
Dynamic content is also best served from a different drive (virtual or  
real)  
then where nginx is running from.

Posted at Nginx Forum:

> **[Re: Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260204#msg-260204)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 10, 2015, 11:07pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/7 "2015-07-10T23:07:29Z")

</div>

Thanks for the information 🙂 everything is default though so i am not  
sure  
what i should even be changing anything to.

On the mapped hard drive “Z:/” it has the settings  
[![](http://i633.photobucket.com/albums/uu52/C0nw0nk/Untitled9.png) ](http://i633.photobucket.com/albums/uu52/C0nw0nk/Untitled9.png)

Posted at Nginx Forum:

> **[Re: Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260205#msg-260205)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 11, 2015, 6:46pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/8 "2015-07-11T18:46:54Z")

</div>

This is expected behavior if you are using PHP sessions.

See [PHP: session\_write\_close - Manual](http://php.net/manual/en/function.session-write-close.php)

---

<div class="post-metadata">

**Author:** ![c0nw0nk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58f4c7/32.png) [@c0nw0nk](https://www.ruby-forum.com/u/c0nw0nk)\
**Post date:** [July 11, 2015, 9:54pm UTC](https://www.ruby-forum.com/t/nginx-php-windows-network-sharing-uploads-locking-slow-load-time/242646/9 "2015-07-11T21:54:25Z")

</div>

So its because i’m using PHP’s built in file session handler ? Should i  
switch it to maybe Wincache or something ?

Posted at Nginx Forum:

> **[Re: Nginx + PHP Windows Network Sharing Uploads locking/slow load time](https://forum.nginx.org/read.php?2,260193,260215#msg-260215)**
>
> So i have Nginx as a web server with PHP running as fastcgi what nginx serves traffic via upstreams. The strange bug i have encountered is the fact when i upload a large file lets say 2GB and PHP must pass this file to a mapped hard drive via network...
