I would like to run action http://site.com/rss/rss_import which downloads many large files.
I use:
ignore_user_abort();
set_time_limit(0);
After about 60 seconds I get the following message:
504 Gateway timeout
When I run rss_import.php directly, the 504 error does not occur.
What can I do about that?
504 Gateway Timeout (you are probably using nginx) is web-server-related, not php-related. The server simply stops waiting for data from the php-fcgi.
Either change the config of nginx (see http://wiki.nginx.org/HttpFastcgiModule#fastcgi_read_timeout) or use the command line as ArneRie has already suggested.
//edit: In the (unlikely) case that you are using Apache with fcgi I want to put the parameter for apache, too: https://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidiotimeout