Start another process?

Start another process?

am 06.09.2007 15:41:44 von Tedois

Hey guys,

I'm having trouble generating a report in fpdf. It's huge and taking a
*lot* of time, causing timeouts. I've tried everything in fpdf without
much success. I can't break the report into smaller pieces nor change
it.

What I want to do now is create another process that generates the
report, and the php app to keep "asking" if the report is ready and
when it is, just show it.

Now, how am I supposed to do that? Is it possible to be done? SOAP?
XML-RPC? Any ideas?


Thanks in advance,
Thiago

Re: Start another process?

am 06.09.2007 16:44:42 von Erwin Moller

Tedois wrote:
> Hey guys,
>
> I'm having trouble generating a report in fpdf. It's huge and taking a
> *lot* of time, causing timeouts. I've tried everything in fpdf without
> much success. I can't break the report into smaller pieces nor change
> it.
>
> What I want to do now is create another process that generates the
> report, and the php app to keep "asking" if the report is ready and
> when it is, just show it.
>
> Now, how am I supposed to do that? Is it possible to be done? SOAP?
> XML-RPC? Any ideas?
>
>
> Thanks in advance,
> Thiago
>

Hi,

Difficult. This involves polling from the client, starting a fresh
process that may run for ages, and making sure the polling clients gets
the info that the report is ready.
Can be done, but I would prefer to take another (less errorprone) route.

I think I would chicken out as follows (just an idea):
1) tell the visitor to give an emailaddress. (where the report must go)
2) Store in your database the details you need to generate the report,
along with the emailaddress.
3) Make a cronjob that runs every 5 minutes and calls some php-file that
checks if a new pdf-generating job is stored in the db.
4) If so, run the pdf-job, email the result, and flag the job as done.

That way you only use 'standard' buildingblocks and do not have to start
new processes. (At least what I consider 'standard buildingblocks').

just my 2 cent.

Regards,
Erwin Moller

Re: Start another process?

am 07.09.2007 15:59:58 von colin.mckinnon

On 6 Sep, 14:41, Tedois wrote:
> Hey guys,
>
> I'm having trouble generating a report in fpdf. It's huge and taking a
> *lot* of time, causing timeouts. I've tried everything in fpdf without
> much success. I can't break the report into smaller pieces nor change
> it.
>
> What I want to do now is create another process that generates the
> report, and the php app to keep "asking" if the report is ready and
> when it is, just show it.
>
> Now, how am I supposed to do that? Is it possible to be done? SOAP?
> XML-RPC? Any ideas?

Any of the above - but you have to work out how to spawn the other
process safely -but that's a FAQ - try google for more info.

Personally I'd use a display page which launches the generator and
contains an AJAX connection to a poller which monitors the report
generator - but remember that it needs to be a 2 way connection
between the poller and the report generator (or tie it into the
session) otherwise you're likely to get too many processes spawned.

C.