Anil Singh
Anil Singh

Reputation: 101

Why am I getting an HTTP 504 gateway timeout with Apache 2.4.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)

Upvotes: 7

Views: 44387

Answers (1)

FAEWZX
FAEWZX

Reputation: 1029

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

Upvotes: 15

Related Questions