A PHP script I am working on is having a very strange problem. This script is supposed query a database, and then write the results to file, all the while displaying its progress by outputing a pipe character as it goes.

Problem is, it doesn't do that. In fact, it won't show anything. Not the output of the print statement verifying the form was submitted and not the line of pipes which are supposed to represent a progress bar even though ob_implicit_flush(1) is set. I can watch as the file it is to write grows in size and then eventually finishes, but still, the browser spins its little loading indicator in the upper right hand corner while the form remains on the page. In fact, this will never stop. The form will remain on the screen depite the fact that the script has long since finished its work, never displaying the results into the browser window.

Here is the real kicker that has me totally baffled. This script is written for PHP 4 compatibility as it will be running primarily on a live server with PHP 4, Apache 1.3, and Linux. My local test server runs PHP 5, Apache 2, and Windows XP. However, using the same browser and the same script I can execute them side-by-side and watch as nothing happens with the form page on the live remote server but the local test server executes the script flawlessly.

No errors show up in the logs of either server and the results written to the file are identical. What further baffles me is that, after numerous attempts at identifying the problem, it stops being a problem on the live server and suddenly starts happening on the local test server! Each time I ensure that the code each server is running is identical if I update it. In fact, sometimes the problem will go away and come back without even changing the code at all.

I am pulling out my hair here. If anyone has heard of any such thing happening that is similar, please let me know...especially if there is a fix.

I wish I could post the script here but it comprises thousands of lines of company code.

Thanks in advance for any input.