According to the documentation it should not be a problem http://wiki.dreamhost.com/Creating_custom_error_pages
I think you need to use a local path like
ErrorDocument 504 /cgi-bin/error.php?code=504
Question
In the software I developed, the user can send a XLS file that the PHP uses to insert rows to the database. Usually one file has 1500 lines and results in 7000 lines in the database. The process usually takes 5 to 7 minutes to complete.
After sometime I get a 504 Gateway Time-out error. I did a research and find out that the solution is to increase the max execution time. I tried that and nothing, it's like the configuration is ignored.
max_execution_time = 600
max_input_time = 600
Then I tried to set this directly at the PHP, using the functions ignore_user_abort
and set_time_limit
. Again, it did not work.
set_time_limit(0); //never time out
ignore_user_abort(true); //ignore abort
After this I gave up, and decided to make a custom error page to explain why the error occurred and then redirect back to the control panel. So, I went to my .htaccess that have the following content:
# Turn on the RewriteEngine
RewriteEngine On
Options +FollowSymLinks +Includes
Options -Indexes
IndexIgnore */*
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule . index.php?/$0 [L]
And added the following statement:
ErrorDocument 504 http://domain/erros/timeout/
When the error occurs again, instead of redirecting to the URL, it shows the default error page.
UPDATE
I use dreamhost shared hosting.
No correct solution
OTHER TIPS
According to the documentation it should not be a problem http://wiki.dreamhost.com/Creating_custom_error_pages
I think you need to use a local path like
ErrorDocument 504 /cgi-bin/error.php?code=504