If that app is generating a lot of data, then that would explain why you need a larger timeout. You may even need to go higher if the app takes a while to generate the download. That's typically when I increase it -- because of waiting on an app to process.

Is the file being streamed -FROM- PHP or is PHP generating a file and you are later downloading that saved file?

If PHP is actually the backend and is delivering the file to you straight from the script, then it's possible PHP could be the issue. PHP might have some insufficient limits on timeouts or memory, and could be killing the delivery after it hits that limit. Double-check your php.ini file to see if you have error logging enabled and being written to some error log file somewhere. (If you change the php.ini file, you'll have to restart Apache or if it's Fast-CGI, you might have to restart the FPM)

Once you have error logging turned on, trigger the problem and check the PHP error log. (It's worth checking even if PHP isn't streaming the file directly)

Also bear in mind that PHP can be configured to be the processor for ANY request, not just for files ending in .php, which is why I suggested the error log even if you think it's a static file. I've seen some setups before where PHP was the handler for every request inside a specific domain (which is a bad idea, but that's what was happening).

It is not PHP as it happens also with a 3 MB txt file that I try to wget or curl.
But it is streamed FROM php. The application is called "moodle" but has nothing to do with it as for the reasons stated before.

That's why I added the caveat of PHP handling any requests, too. Even when you download a text file, PHP can still be handling the request invisibly, depending on your setup. So even though downloading the text file SHOULD have nothing to do with PHP, PHP might still be involved. That's why I suggested checking the PHP error log anyway.

Okay, if the delivery software (Apache / PHP) isn't breaking the feed, then that means something else that interacts with the data stream IS.

Since you don't see the problem when on the same network or on the same server, that either points to:

1. The server having some internet traffic analysis tool that has rules that interfere with requests from external IPs (external to the network). This is less likely, but if you have any security applications that monitor traffic (e.g. internet security suites), it's worth considering. This would be more likely if it were "home" internet security suite that wouldn't expect things to be running on port 80, much less delivering lots of traffic (which could indicate malware for a home user).

2. Most likely is some traffic manipulation by the router, security appliance (hardware), or other hardware involved in traffic that exits the network. Sometimes default rules on security appliances (Fireboxes, Smoothwalls, etc...) can get a little overzealous. Check the logs.

3. If the internet connection is a home type of internet connection (e.g. the kind that doesn't like users running servers), your ISP may be "detecting" and canceling the remote user's download. This is less likely, since an ISP is going to be hard-pressed to know the difference between a remote user downloading an Excel document from you and you uploading the same document somewhere (which almost any ISP would allow). You could test this by downloading the file via HTTPS (use a self-signed cert), and seeing if it makes a difference.

Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…

Note: for this to work properly you need to use a Cross-Over network cable.
1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…

If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…

If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you!
In this Micro Tutorial, you'll learn yo…