PDA

View Full Version : PHP kills browser?


catbert303
04-16-2003, 03:23 PM
This has been puzzling me for a while, I have a flash movie that calls a PHP script every few seconds, PHP does its stuff and returns results to flash, this all seems to work.

The problem comes using internet explorer, and to a slightly lesser extent Mozilla, it is that the script eventually stops opening, and after running the movie no further pages can be opened from my server during the current browser session (Mozilla does open them but takes a long time (about a minute on a modem) to open the first one after the movie), at first I assumed I was just overloading the server and it simply wasn't sending the page, but the thing that really confuses me is the problem doesn't seem to occur at all using opera (so maybe the problem isn't with the server).

to test I tried replacing the original script with a dummy script (something nice an simple) that just picks random entries from an array and returns them to flash, using this script I haven't yet come across the same problem, but if I add a line,

sleep(5);

to it, the problems return. any ideas why the browser seems to care about what the script is doing and its execution time?

Thanks

freddycodes
04-16-2003, 06:22 PM
So you have that line in the script that is mucking up?


sleep(5);


I do believe its a matter of the PHP never finishes executing. Why do you noeed the sleep() function anywa?

catbert303
04-16-2003, 07:37 PM
The sleep function was just used in a test script to try to simulate the longer execution time of the real script (the real script is reasonably long, basically it opens a socket connection to a page, reads content from the page picks out information and saves it in a database, then returns results to flash)

after several attempts at commenting out sections/altering functionality in the script (removing all database functions, trying fopen instead of fsockopen etc) to see if I could find a specific section that was causing the trouble I decided to just test using a very simplified script that pretty much does nothing except return values from an array to flash (the idea being if this script eventually failed too I could hopefully be sure that it was nothing dumb I was doing causing it to happen ;)).

There seems to be no problem with this, however in an attempt to mimic the execution time of the real script in the test script more closely I added the sleep function, this is called before the output functions are called, so I think (hope ;)) the script does finish executing.

catbert303
04-17-2003, 11:05 PM
On some futher testing, the original script that eventually seems to disable the browser (internet explorer and mozilla on windows) seems to run okay in mozilla running on solaris.

a co-worker suggested a possible (long shot) reason. on the basis that IE and Mozilla (on windows) possibly both still share some code dating right back to Mosaic, whereas opera (which works okay) would have been built from scratch. the fact mozilla running on a UNIX operating system worked, seems to fit in with this.

would any kindly mac user be able to check the link, play the game for a few minutes then try refreshing the main page, see if Mac IE (or other browsers) choke in the same way IE on windows seems to,

thanks :)

http://king-maths.kingston.ac.uk:9090/~Andrew/php4/launch.php