Start another process?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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

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,

Re: Start another process?

Tedois wrote:
Quoted text here. Click to load it


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.

Erwin Moller

Re: Start another process?

Quoted text here. Click to load it

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.


Site Timeline