Jump to content

Recommended Posts

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 by milanello72
Link to comment
https://forums.phpfreaks.com/topic/273386-ignore_user_abort/#findComment-1407096
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/273386-ignore_user_abort/#findComment-1407098
Share on other sites

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 by Christian F.
Link to comment
https://forums.phpfreaks.com/topic/273386-ignore_user_abort/#findComment-1407099
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/273386-ignore_user_abort/#findComment-1407100
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.