reakt Posted March 4, 2009 Share Posted March 4, 2009 Hi there, I was previously running on php on IIS and have recently switched over to Apache 2.2. I have a php script that starts with something like: echo "Processing, please wait..."; It then reads in a text file line by line, outputting the lines to other text files depending on several conditional statements. The input file can be up to 100MB so the script sometimes takes 5-10 mins to run. After the process is complete it goes: echo "Done!"; Previously on IIS when you first loaded the page you would see "Processing, please wait..." while the script processed, then when it finished, you would see on the screen "Processing, please wait...Done!". The word Done having appeared only after the script finished processing. Now since changing to apache when the page loads nothing is displayed on screen for 5-10 minutes while the script is processing, then when it finishes, you get Processing, please wait...Done!" all at once. For some reason it processes the whole script before doing any of the echo commands. Basically I just want to know how I can display something on the screen before the processing begins. Thanks! Quote Link to comment Share on other sites More sharing options...
corbin Posted March 4, 2009 Share Posted March 4, 2009 It will depend on some things. First, you will have to tell PHP to flush the buffer(s). http://php.net/ob_flush Then, you will have to make sure no Apache modules are buffering content. Quote Link to comment Share on other sites More sharing options...
reakt Posted March 5, 2009 Author Share Posted March 5, 2009 ob_flush worked great, thank you Quote Link to comment Share on other sites More sharing options...
corbin Posted March 5, 2009 Share Posted March 5, 2009 No problem ;p. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.