Why am I getting an HTTP 504 gateway timeout with Apache 2.4.6?
Asked Answered
U

1

6

Getting 504 gateway timeout in response if the server takes more than 60 secs, process on the server keeps running and complete its execution but on client side getting response 504 gateway timeout of 60 secs so suspecting apache not waiting for PHP to complete its execution and sending gateway timeout response.

Read somewhere that can't increase timeout for apache 2.4.6 it is a known bug for that particular version, so can't try out by increasing the timeout for Apache. My site is running over https and any request that is taking more than 60 sec processing fro php side, getting response gateway timeout 504.

Note: No proxy and no load balancer is there, the server is setup on Amazon EC2 and running (LAMP: Linux CentOS 7, Apache 2.4.6, MySQL 5.7, PHP 5.6)

Ultun answered 27/8, 2019 at 15:20 Comment(6)
If php and server continue to work but your browser display timeout it's ok for you ?Flowers
how run php - php-apache-module php-cgi php-fmp ?Tuberculin
@Tuberculin php-apache-moduleUltun
@Xenofexs, No that is an issue and looking solution for that hereUltun
Was this resolved? I'm facing the same issue, client getting 504 from server after 60 seconds although PHP keeps running and all config is set to 600.Highstrung
I found out the problem on my side - it was a load balancer timeout. We're using AWS load balancer and it's default timeout was 60 seconds, this was a pain to catch, hope it could help others.Highstrung
T
14

Increasing the max_execution_time limit in php.ini

max_execution_time=600

Increase the default timeout value in the httpd.conf

Timeout 600

At the beginning of the script, start displaying information, for example

print " ";

continue to send data periodically to maintain the connection

Tuberculin answered 28/8, 2019 at 7:18 Comment(3)
On AWS EC2 (LAMP) the Timeout directive in httpd.conf did the trick.Krill
Timeout wasn't even in my httpd.conf file. Adding it though did the trick!Income
Didnt have Timeout in my httpd.conf (Mac os). Added it and that did the magic.Shawannashawl

© 2022 - 2024 — McMap. All rights reserved.