ERR_CONNECTION_RESET with PHP script

后端 未结 5 2027
悲哀的现实
悲哀的现实 2021-01-24 17:52

I have a PHP scripts that downloads and process some files. Sometimes the number of files is very large, so it takes some time.

But when there are a lot of files to proc

5条回答
  •  春和景丽
    2021-01-24 18:39

    If there are too many files to process, you'll eventually stumble upon this issue whatever your configuration. Even if you disable all timeouts server-side, the client itself has its own safety features and will eventually timeout after a certain time — something you can't control.

    You are doing it wrong” here. You cannot do any heavy computation in a HTTP request because of this kind of protocol limitations (TCP, HTTP).

    Your request has to spawn some kind of background task that will notify of its progress from time to time. Using a shared hosting with PHP only, this might not be easy to accomplish, so you may want to find another way of doing your heavy computation.

提交回复
热议问题