PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > stopping php & keeping php alive
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
stopping php & keeping php alive

Réponse
 
LinkBack Outils de la discussion
Vieux 14/02/2008, 14h36   #1
Dan99
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut stopping php & keeping php alive

Hi,

First of all, I am looking for a way to force the execution of a php
script to explicitly stop when told to do so by the client
connection. I know when you hit the browser stop button php normally
stops, but it doesn't stop immediately (ie. if the script is in a
loop, it will keep going for a bit). Also, I am looking for a way to
force php to stay alive, even if the connection to the client drops.
Finally, does anyone know of a way to enable chatter between a single
php script and its client (ie. php well send out something, then the
client will respond, and then php will send another something, ...)

Thanks,
Daniel
  Réponse avec citation
Vieux 14/02/2008, 15h20   #2
ZeldorBlat
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: stopping php & keeping php alive

On Feb 14, 9:36 am, Dan99 <power...@gmail.com> wrote:
> Hi,
>
> First of all, I am looking for a way to force the execution of a php
> script to explicitly stop when told to do so by the client
> connection. I know when you hit the browser stop button php normally
> stops, but it doesn't stop immediately (ie. if the script is in a
> loop, it will keep going for a bit). Also, I am looking for a way to
> force php to stay alive, even if the connection to the client drops.
> Finally, does anyone know of a way to enable chatter between a single
> php script and its client (ie. php well send out something, then the
> client will respond, and then php will send another something, ...)
>
> Thanks,
> Daniel


Use ignore_user_abort():

<http://www.php.net/ignore_user_abort>

That will definitely answer your second question. I'm not sure if
there's much you can do about the first one, though. You might try
checking inside the loop if the connection has been aborted and then
breaking out of it.
  Réponse avec citation
Vieux 14/02/2008, 17h09   #3
Rik Wasmus
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: stopping php & keeping php alive

On Thu, 14 Feb 2008 16:20:50 +0100, ZeldorBlat <zeldorblat@gmail.com>
wrote:

> On Feb 14, 9:36 am, Dan99 <power...@gmail.com> wrote:
>> Hi,
>>
>> First of all, I am looking for a way to force the execution of a php
>> script to explicitly stop when told to do so by the client
>> connection. I know when you hit the browser stop button php normally
>> stops, but it doesn't stop immediately (ie. if the script is in a
>> loop, it will keep going for a bit). Also, I am looking for a way to
>> force php to stay alive, even if the connection to the client drops.
>> Finally, does anyone know of a way to enable chatter between a single
>> php script and its client (ie. php well send out something, then the
>> client will respond, and then php will send another something, ...)
>>
>> Thanks,
>> Daniel

>
> Use ignore_user_abort():
>
> <http://www.php.net/ignore_user_abort>
>
> That will definitely answer your second question. I'm not sure if
> there's much you can do about the first one, though. You might try
> checking inside the loop if the connection has been aborted and then
> breaking out of it.


In a HTML context, spaces are no content, and if you have no buffering
mechanism somewhere, a simple statement like this in every loop:
echo ' ';
flush();
if(connection_aborted()) exit;

....could very well halt execution sooner. However, if you need to stop
'dead on', HTTP is not the way to go.
--
Rik Wasmus
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h10.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11145 seconds with 11 queries