504 Gateway Time-out

7 posts / 0 new
Last post
#1 Fri, 02/08/2013 - 04:20
anmay

504 Gateway Time-out

I am using Virtualmin on CentOs 6.3. My PHP script execution mode is CGI wrapper (run as virtual server owner). When some one open heavy process php file (eg. display all record for database) then browser alsways in waiting mode and it returns 504 Gateway Time-out. I am not able to solve this issue please help me. I have same server with same application with cpanel it working fine.

Fri, 02/08/2013 - 09:51
andreychek

Howdy,

It sounds like your script is taking longer to run that the PHP timeout allows for.

Try going into Server Configuration -> Website Options, and in there, and change "Maximum PHP script run time" to a higher number... perhaps 45 or 60 seconds.

-Eric

Fri, 02/08/2013 - 22:28
tpnsolutions
tpnsolutions's picture

Hi,

While Eric's suggestion will update the execution time without issue, if you would like "just" a few scripts to exceed the default maximum, you can set this within the script setting set_time_limit through the ini_set function. This method will override the defaults on a per script basis.

You can read more about this feature at:

http://php.net/manual/en/function.set-time-limit.php

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Sat, 02/09/2013 - 01:10
anmay

Dear Eric Already Maximum PHP script run time is 90 sec, when server not responding then we stop and refresh after this it open fast. we face this error some time, it behave like website is hanged. I also check error only show in browser but php script in running in server it continue working. I process some data between two mysql tables browser return 504 error but script continue process data from one mysql table to another table.

PHP script execution mode is "CGI wrapper" If you PHP script execution mode is "FCGId (run as virtual server owner)" then it return 500 internal server error.

Wed, 02/13/2013 - 12:02 (Reply to #4)
tpnsolutions
tpnsolutions's picture

Hi,

5xx errors generally are a result of a script hanging, which is usually related to the script having errors which the interpreter is attempting to correct (PHP generally can correct many errors). It is recommended to check the source code of the script running and look for errors, missing dependencies, etc. The easiest way to debug most PHP errors if the script is being run from the browser is to check the "error_log" directly after the error appears.

Best Regards,
Peter Knowles
TPN Solutions

E: pknowles@tpnsolutions.com
P: 604-782-9342
W: http://www.tpnsolutions.com
Best Regards,
Peter Knowles | TPN Solutions
Email: pknowles@tpnsolutions.com | Skype: tpnassist
Mon, 02/11/2013 - 11:12
anmay

I am Waiting for Ans please answer me.

Mon, 02/11/2013 - 13:39
andreychek

Well, I unfortunately don't have an answer for you... it doesn't sound like you're dealing with a server issue, it sounds like an issue with your script, or the data in the database.

You'll likely need a developer to debug the PHP script you have there. It's a matter of determining what the script is doing, and why it's taking so long to run.

-Eric