0

I've got a poorly written PHP script, which takes several minutes to prepare the HTML output. I tried to run this script in DDEV, but always hit the Gateway Timeout.

To avoid this, I want to increase the timeout value, used by DDEV router! But I did not found any possibility to configure it.

How can I configure the DDEV router itself?

An .ddev/nginx/nginx-site.conf in the project, has no impact to the DDEV router itself.

Thanks!

Armin
  • 15,582
  • 10
  • 47
  • 64

1 Answers1

0

I think there are three things that you can think about here:

  1. How long does the php-fpm wait before timing out. (The default for DDEV is not to time out... but you may have overridden this in your project's configuration, for example in settings.php for Drupal.)
  2. How long does nginx in the web container wait before timing out. I assume you're using the nginx-fpm webserver type and not apache-fpm. If you were using apache-fpm you'd have to configure the apache config of course to change the timeout.
  3. How long does ddev-router wait before timing out. (And this may be different based on whether you use the older traditional ddev-router, or the new Traefik-based router which has been available for several months and will be the default router in DDEV v1.20.

Of course, you probably want to solve the problem with your PHP code. And of course, if it's possible, running the script from the command line would give you control of this and you wouldn't care about the chain of servers involved or any timeouts.

To find out if the problem is unrelated to the ddev-router, just use the 127.0.0.1 URL provided in ddev describe under "all URLs". And if that's all you need then you don't have to go any farther if you don't want, just use that URL and you've factored ddev-router out of the equation.

  1. The default max_execution_time for php-fpm is 0, so it's not likely the problem. But you can change that to see what happens. But 0 should be "allow forever".
  2. The amount of time that the ddev-webserver waits for php-fpm is set everywhere to 10 minutes, and that's in the .ddev/nginx-full/nginx-site.conf. Do you get the gateway timeout after 10 minutes? That's a long time.
  3. Assuming that the 127.0.0.1 URL isn't good enough for you, you can fiddle with the router's configuration, but there are several ways to do it. It sounds like more work than you want given your goal of just getting this PHP script to complete. If you're using traefik, you can override the config using things like https://doc.traefik.io/traefik/routing/services/#forwardingtimeouts, see https://ddev.readthedocs.io/en/stable/users/configuration/experimental/#traefik-configuration

It may be easier to chase this more interactively if you want to come over to Discord, https://discord.gg/hCZFfAMc5k - it will help to know what CMS or framework you're using, etc.

rfay
  • 9,963
  • 1
  • 47
  • 89