0

I'm testing my PHP Limit on WordPress site and keep getting a 504 Gateway Time-out.

I'm changing the max_execution_time in php.ini to reflect the value of 600.

Followed by restart when I test the PHP Limit it gives me a 504 Gateway Time-out.

Upon checking php -i I get the following result; max_execution_time => 0 => 0

the ini file is pointing at /etc/php/7.0/cli and this is the one I am configuring.

Contacting support they have stated;

That command checks the overall php ini settings, not for the application. The bad gateway error may be because of an error in the configuration setup. Try verifying the configuration file and checking your error logs.

Checking contents for error log, nothing recorded.

1 Answer 1

1

There are basically 3 sets of timeouts when dealing with simple NGINX + PHP-FPM stack.

One is PHP engine, which you have already adjusted to unlimited.

Second is PHP-FPM, which is controlled via request_terminate_timeout in your pool settings. The default is usually like this:

;request_terminate_timeout = 0

Value of 0 would mean that there is no limit set by PHP-FPM itself, so you likely won't have to adjust that.

Finally, there are NGINX timeouts for FastCGI communication, which are controlled through a couple of directives in your NGINX config. You mostly care about fastcgi_read_timeout:

If the FastCGI server does not transmit anything within this time, the connection is closed.

You would place it in your PHP handler location, e.g.:

location ~ \.php$ {
    ...
    fastcgi_connect_timeout 600s;
    fastcgi_pass ...;

P.S. Don't confuse "Bad Gateway" (502) and "Gateway Time-out" (504) errors. Those are different errors: the former is for a failure to communicate with PHP-FPM (typically a sign of severe misconfiguration, defunct / not running PHP-FPM process), while the latter is exceeding timeout while communicating with PHP-FPM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.