473,804 Members | 3,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling extended script execution times

A couple of questions:

(1) I have some PHP code that may take a while to execute - say 30-45
seconds or more - and I'm concerned that a browser may give up, and
report an error because a page is not returned within a certain amount
of time. How can I handle this?

Should my PHP script (that generates the webpage) call another PHP
script to do the long-processing task, allowing it to exit earlier
(with a generated webpage), or what?

(2) (a) I'm interested to know how some of these travel sites (Orbitz,
Priceline etc.) can go off and do a search, that sometimes goes on for
a while.

(b) And sometimes I've noticed these types of pages will refresh,
saying things like "Hang on in there... we're still searching."

Does anybody have any advice regarding these questions, or pointers to
more information?

Thanks in advance, Simon.
Jul 17 '05 #1
2 2101
SimonC wrote:
A couple of questions:

(1) I have some PHP code that may take a while to execute - say 30-45
seconds or more - and I'm concerned that a browser may give up, and
report an error because a page is not returned within a certain amount
of time. How can I handle this?

Should my PHP script (that generates the webpage) call another PHP
script to do the long-processing task, allowing it to exit earlier
(with a generated webpage), or what?

(2) (a) I'm interested to know how some of these travel sites (Orbitz,
Priceline etc.) can go off and do a search, that sometimes goes on for
a while.

(b) And sometimes I've noticed these types of pages will refresh,
saying things like "Hang on in there... we're still searching."

Does anybody have any advice regarding these questions, or pointers to
more information?


see the php manual for ignore_user_abo rt() and set_time_limit( ).

If you want to use PHP to control a backend process ... that's another can
of worms. PHP provides sockets and shared memory functions....bu t if you
want to run the process on demand (and don't want to use [x]inetd) you'll
need to dissociate the spawned job from the current process group (if
you're using Unix) - I use 'at now ...' for this.

HTH

C.
Jul 17 '05 #2
"Colin McKinnon1" wrote:
SimonC wrote:
A couple of questions:

(1) I have some PHP code that may take a while to execute -

say 30-45
seconds or more - and I'm concerned that a browser may give

up, and
report an error because a page is not returned within a

certain amount
of time. How can I handle this?

Should my PHP script (that generates the webpage) call

another PHP
script to do the long-processing task, allowing it to exit

earlier
(with a generated webpage), or what?

(2) (a) I'm interested to know how some of these travel

sites (Orbitz,
Priceline etc.) can go off and do a search, that sometimes

goes on for
a while.

(b) And sometimes I've noticed these types of pages will

refresh,
saying things like "Hang on in there... we're still

searching."

Does anybody have any advice regarding these questions, or

pointers to
more information?


see the php manual for ignore_user_abo rt() and
set_time_limit( ).

If you want to use PHP to control a backend process ... that's
another can
of worms. PHP provides sockets and shared memory
functions....bu t if you
want to run the process on demand (and don't want to use
[x]inetd) you'll
need to dissociate the spawned job from the current process
group (if
you're using Unix) - I use 'at now ...' for this.

HTH

C.


If you want to use php for a backend process, then execute php from
command line (CLI). That is the reliable way of doing batch/backend
processing. If you are doing a front-end process, like travel sites
having you wait for the query, that is another subject, and I hope
others can answer.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-Handling...ict160356.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=539439
Jul 17 '05 #3

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

Similar topics

2
3275
by: WSeeger | last post by:
When creating a new class, is it encouraged to always include error handling routines within your LET and GET procedures? It's seems that most text books never seem to include much about error handling within classes. Just hoping to hear some programmer's thoughts on error handling.
9
3208
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
5
6307
by: Boris Nikolaevich | last post by:
This is backwards of what I usually want--normally if you have a long-running ASP script, it's a good idea to check to see whether the client is still connected so you can cancel execution. However, I have a script that absolutely MUST finish one it's been started--is there a way to cause the entire script to execute, even if the client disconnects in the middle of the process? It doesn't matter if the script returns anything to the...
3
1801
by: #pragma once | last post by:
That's all we are expecting from programs written in the managed code; Though a MVP advised not to say that, because after JIT compilation the code runs in the native! Funny, isn't? That means scripting languages run in the Host code and never in the native? That means scripting languages are poorer than .NET in speed just because they are hosted by an interpreter? What about .Net run time libraries? Can any one tell me the differences?...
21
4429
by: Anthony England | last post by:
Everyone knows that global variables get re-set in an mdb when an un-handled error is encountered, but it seems that this also happens when the variable is defined as private at form-level. So if "global variables get re-set" doesn't tell the whole story, then what does? ***please note*** I'm not looking for a solution - I'm looking for a more detailed description of what happens when an un-handled error occurs - possibly with help file...
14
1850
by: Mr Newbie | last post by:
I am often in the situation where I want to act on the result of a function, but a simple boolean is not enough. For example, I may have a function called isAuthorised ( User, Action ) as ????? OK, this function may return a boolean, and if this is true, then no message back is really required, but if it fails then some supporting message needs to be returned to the calling code. As I see it there are a few options.
13
48099
by: ramif | last post by:
Is there a way to print extended ASCII in C?? I tried to code something, but it only displays strange symbols. here is my code: main() { char chr = 177; //stores the extended ASCII of a symbol printf("Character with an ascii code of 177: %c \n", chr); //tries to print an ASCII symbol...
9
2195
by: beginner | last post by:
Hello, We are writing a performance critical application. As a result, we use Array instead of List or any other more sophisticated container types to store temporary data. However, the array type is of fixed length, and therefore there is a chance for the index to be out of range. I expect this to happen once every a hundred times of execution and when this happens, I'd like to create a bigger array. To prevent the bounds from being...
1
1036
by: John [H2O] | last post by:
Hello, I am writing some scripts that run a few calculations using scipy and plot the results with matplotlib (i.e. pylab). What I have found, however, is that the bulk of the time it takes to run the script is simply in loading modules. Granted, I am currently using: from pylab import * However, changing this to the specific classes/functions doesn't make a significant difference in the execution time.
0
9579
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10571
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10075
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9143
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6851
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3815
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.