Page 1 of 1
"The page cannot be displayed" error. Timeout?
Posted: Tue Jun 19, 2007 8:24 pm
by ruth
Hi everyone,
I have a script that exports records from MySQL to a csv file. The csv file has about 1 million rows. I estimate that script runs up to 5 minutes, so I use set_time_limit() to set time limit. I tried 10 to 20 minutes, and even tried set_time_limit(0). However, how long the time limit I set, I always got "The page cannot be displayed" error after 2 minutes. I checked max_execution_time. It is set to 30. I run out ideas now

. Your help is highly appreciated.
By the way, the script works fine when I cut the number of records.
Thank you in advance
Posted: Tue Jun 19, 2007 8:35 pm
by superdezign
Perform it in portions.
Posted: Tue Jun 19, 2007 8:36 pm
by feyd
"The page cannot be displayed" is a browser choice, not the server's. If PHP responds, in some fashion, it renders a completely blank page if nothing else.
Posted: Tue Jun 19, 2007 8:46 pm
by superdezign
feyd wrote:"The page cannot be displayed" is a browser choice, not the server's.
Would that be why Safari shows that page more than Firefox?

Posted: Tue Jun 19, 2007 9:35 pm
by ruth
Thank you for your replies. I tried this script using Firefox, and had the same error message at the same time (2 minutes). I can break the records into portions. However, I would like to know why set_time_limit does not have effect.
Posted: Tue Jun 19, 2007 9:40 pm
by feyd
ruth wrote:Thank you for your replies. I tried this script using Firefox, and had the same error message at the same time (2 minutes). I can break the records into portions. However, I would like to know why set_time_limit does not have effect.
The browser hasn't received feedback, or enough feedback, from the server to tell it more. The browser is simply giving up on waiting for a response.
The script continues to run regardless of the browser waiting for data or not.
Posted: Tue Jun 19, 2007 10:41 pm
by superdezign
Maybe if you randomly echo "Processing..." to the screen or something....
Posted: Tue Jun 19, 2007 11:00 pm
by ruth
I tried to echo "wait ..." out, but nothing comes to the screen. I used ob_flush() and flush().
Posted: Tue Jun 19, 2007 11:17 pm
by feyd
Servers often have their own output buffer. "Wait..." repeated a few times may not fill it up enough for it to begin sending data.
I would reconsider your approach on this. For lengthy operations I often ask for an email address they can be contacted at. The end of the script will then notify the user when and where their data can be picked up, and for how long it will remain available. In other implementations I've had the script email the finished file, provided it was under a certain size.
Posted: Thu Jun 28, 2007 7:51 pm
by ruth
I posted this thread a week ago. After received all your opinions, I spent days to work on this, and finally solved the problem. I post my solutions here in case any one else is in the same situation.
I have two solutions:
1. Send a message every 5 seconds to the browser using ob_flush() and flush(). You will need to set output_buffering to be very small (I set 2). However, I found ob_flush() and flush() will not work with an interactive feature on the page.
2. Using command line (php or wget) to run the script. However, as users do not have an access to the command line, I set up a cron job for the script to run.
Thank you for all your help.
Ruth