D
D
Dmitry2018-12-17 20:54:02
PHP
Dmitry, 2018-12-17 20:54:02

How to avoid 504 Gateway Timeout error?

Hello everyone, I asked myself this question, I started writing a bot in php, I need the script to run for a short period of time when the script is launched in the browser, let's say it's 5-10 minutes, but it will give a 504 Gateway Time-out error in 30 seconds
. I need code optimization, I need to avoid the 504 error
. Maybe I'm not writing the bot correctly?
Is it possible to make the script run as long as it needs?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Flying, 2018-12-17
@maxdit

Judging by the 504 Gateway Time-out, you have nginx in front of PHP. If this is the case, add a setting to the site configuration to wait for the upstream response time. If you use FastCGI then:
if proxying is used, then:
In general, such scripts are launched not through a web server, but from the console, settingset_time_limit(0);

T
Timofey Tkachev, 2018-12-17
@TTkachev

The simplest thing is to increase the timeout on the server to what is needed.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question