473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Feb 14 '08 #1
2 2444
On Feb 14, 9:36 am, Dan99 <power...@gmail.comwrote:
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.
Feb 14 '08 #2
On Thu, 14 Feb 2008 16:20:50 +0100, ZeldorBlat <ze********@gmail.com>
wrote:
On Feb 14, 9:36 am, Dan99 <power...@gmail.comwrote:
>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
Feb 14 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John | last post by:
Hi I am using the Internet Transfer Control as follows; strData = "Some data" strHeaders = "Content-Type: application/x-www-form-urlencoded" & vbCrLf objInet.Execute strURL, "POST",...
0
by: John | last post by:
Hi I am trying to use the internet transfer control to send some data to a site. I want my MS ISA proxy server to keep the connection alive. What syntax should I use to send the 'keep alive'...
8
by: Martin Maat | last post by:
I am puzzled. I have this object that uses a thread. The thread is encapsulated by the object, the object has Start and Stop methods to enable the client to start or stop the thread. I found...
1
by: Jason James | last post by:
Hi All, I have created a class that references MS Word. The class will happily control Word, adding text, etc. However, when I have finished with the VB app I want to close the app, but not...
1
by: t.mitchell | last post by:
Hi, I have a python gtk app that allows users to have one project open at a time. I have recently discovered that projects are not being freed when they are closed - the refcount is not hitting...
7
by: Lenard Redwood | last post by:
I'd like to create a simple chat application that will leave the connection open for a minute and then restart the connection to the server to push data. I plan to use temporary .txt files to store...
1
by: ThomMCann | last post by:
I have a problem with keeping a page alive while the server is writing large xml files to Oracle. The server time out is set to 15 minutes. I need a programmatic way to keep the jsp connection...
13
by: ray | last post by:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"/ <TITLE>HTML to Text...
4
by: Cyprus106 | last post by:
I'm using the Gps wrapper from the Windows Mobile 6 SDK Example. It's straightforward, and technically, all the code seems to work just fine. The problem is that it never picks up any values,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.