I have the follow unresolved problem regarding PHP and Apache. I have a long running script that ALWAYS return 504 Gateway Timeout after 30 seconds running. However, if I check in /server-process, I can see that the request is still going on. Before being suggested, I'm not expecting it to be a cron job as this long process should finish just under a minute and for current situation, I needed it to run inside browser. Here's what I've set the server:

- Timeout 600

- max_execution_time = 300
- max_input_time = 300

Here's my server info:

root@izzystorage-core:~# lsb_release -r
Release:        16.04

root@izzystorage-core:~# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built:   2017-09-18T15:09:02

root@izzystorage-core:~# php -v
PHP 7.0.22-0ubuntu0.16.04.1 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.22-0ubuntu0.16.04.1, Copyright (c) 1999-2017, by Zend Technologies

Do you guys have any Idea what's going on with my server?


  1. I don't have mod_proxy
  2. This is only one server without load balancer in between

After several hours adjusting Timeout, max_execution_time and max_input_time parameters and multiple service apache2 restart without result, I put back the original parameters (600, 300, 300) and restart the whole server with shutdown -r now. Upon server back online, all problem suddenly resolved.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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