milanello72 Posted January 20, 2013 Share Posted January 20, 2013 Could you give me an example with ignore_user_abort() ? Thank you! Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 20, 2013 Share Posted January 20, 2013 Did you read the manual page? There's a example right there. Quote Link to comment Share on other sites More sharing options...
milanello72 Posted January 20, 2013 Author Share Posted January 20, 2013 (edited) Sure that I have read the php manual, but I have some problems. For exemple in this script from here http://php.net/manual/en/function.ignore-user-abort.php: <?php // Ignore user aborts and allow the script // to run forever ignore_user_abort(true); set_time_limit(0); echo 'Testing connection handling in PHP'; // Run a pointless loop that sometime // hopefully will make us click away from // page or click the "Stop" button. while(1) { // Did the connection fail? if(connection_status() != CONNECTION_NORMAL) { break; } // Sleep for 10 seconds sleep(10); } // If this is reached, then the 'break' // was triggered from inside the while loop // So here we can log, or perform any other tasks // we need without actually being dependent on the // browser. ?>  If I run this script I can't see the message 'Testing connection handling in PHP'. in fact the script is running without ptrint any message. You can see here: http://ionutspot.uhostall.com/1.php  And if i delete ignore_user_abort(true); set_time_limit(0); the script will make the same thing like on the page http://ionutspot.uhostall.com/1.php  So i hope that you understood me, i can't understand how could i use ignore_user_abort.... Edited January 20, 2013 by milanello72 Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 20, 2013 Share Posted January 20, 2013 See, if you had posted all that in your first post you could have gotten help about 4 hours sooner than you will now.  Read the note on the page. Sounds like your script is fine, it just never has a chance to send the message. Your script will never end as far as I can tell. But I've never used that functionality. Now that you've posted what your ACTUAL problem is, someone who does understand it can help. Quote Link to comment Share on other sites More sharing options...
Christian F. Posted January 20, 2013 Share Posted January 20, 2013 (edited) I think the main problem here is that you're not flushing anything out, so it gets held in the web server's output buffer until the client breaks the connection. At that point, there is nowhere to send the content, so the web server is most likely just dropping it silently. Â The script is running, without a doubt. You just need to flush the output to get the message to the client. Edited January 20, 2013 by Christian F. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 20, 2013 Share Posted January 20, 2013 I think the main problem here is that you're not flushing anything out, so it gets held in the web server's output buffer until the client breaks the connection. At that point, there is nowhere to send the content, so the web server is most likely just dropping it silently. Â The script is running, without a doubt. You just need to flush the output to get the message to the client. Which is documented in the manual, under "Notes". Just saying. Quote Link to comment Share on other sites More sharing options...
milanello72 Posted January 20, 2013 Author Share Posted January 20, 2013 For Christian F.: How could i flush the output? Could u show me the code? Thank u! Quote Link to comment Share on other sites More sharing options...
kicken Posted January 20, 2013 Share Posted January 20, 2013 read up on flush and ob_flush. Quote Link to comment Share on other sites More sharing options...
milanello72 Posted January 20, 2013 Author Share Posted January 20, 2013 I have put ob_flush(); flush(); but in browser I don't see 'Testing connection handling in PHP'...How could i solve this problem? 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.