[ciapug] header problem
Dave J. Hala Jr.
dave at 58ghz.net
Mon Apr 6 09:14:35 CDT 2009
I'm gonna try some forking today. I should be able to check for the file
in the parent section and run the monster query in the child section.
$pid = pcntl_fork();
if($pid == -1) {
die('could not fork')
}
else if ($pid) {
// positive value means we're in the parent.
// do whatever parents do
....
// wait for children to complete by calling
// pcntl_wait() or a variant
} else {
// zero value means we're in the child.
// do whatever children do
// (e.g. download the files, then exit)
}
Here's a link with some discussion:
http://immike.net/blog/2007/04/08/fork-php-and-speed-up-your-scripts/
On Fri, 2009-04-03 at 09:56 -0500, Matthew Nuzum wrote:
> On Fri, Apr 3, 2009 at 9:15 AM, Dave J. Hala Jr. <dave at 58ghz.net> wrote:
> > I gave the readfile thing a try, same issue. However, I did manage to
> > get an error message. I got a "couldn't find or couldn't open" error
> > message that listed the script name. (was tough to tell the exact error
> > as an end user was trying to read it to me)
> >
> > When I narrowed the date range so that the report ran faster, it worked
> > fine. It seemed to be problematic when the execution time was above 2
> > minutes. I'm going look for an ssl timeout, a session timeout or maybe
> > in the php.ini for script execution time.
> >
>
> What you can do is to fork the external process as a background task
> and then let the page refresh periodically checking if the output file
> exists. You can actually do this via ajax. It seems like it would
> generate a lot of hits to the server but the hits are very lightweight
> because they just check if the file is there and then return
> instantly.
>
> Here's a good explanation:
> http://nsaunders.wordpress.com/2007/01/12/running-a-background-process-in-php/
>
--
___
Dave J. Hala Jr.
President OSIS, Inc.
www.osis.us
More information about the ciapug
mailing list