Re: Report generation as pdf and csv in php application for huge record set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2011-07-14, at 12:50 AM, Midhun Girish wrote:

> 
> 
> On Thu, Jul 14, 2011 at 11:18 AM, George Langley <george.langley@xxxxxxx> wrote:
> On 2011-07-13, at 11:20 PM, Midhun Girish wrote:
> 
> > Hi,
> >
> >
> > - Browsers generally have a 5 minute time-out. If you send the PDF directly to the browser and reach the limit, it will be lost. It is therefore advised for very big documents to generate them in a file, and to send some data to the browser from time to time (with a call to flush() to force the output). When the document is finished, you can send a redirection to it or create a link.
> > Remark: even if the browser times out, the script may continue to run on the server.
> >
> >
> > When it comes to the user end, they wont wait for more than 1 min. So redirection after generating the report is not possible. But creating link may be a good idea. How can it be done? I mean shouldn't there be a service running in the server to process these request after the execution of the php script is completed? Also shouldn't we post all the report generation request to a database so that serial processing can be done?
> -----------
>        We're helping each other here, as I'm facing a similar situation! Read up on how to store as a file here:
> 
> <http://www.sitepoint.com/generate-pdfs-php/>
> 
> You should then be able to generate an email notification to send once the file is complete, with the link to the newly-created file.
> 
> 
> George Langley
> Multimedia Developer
> 
> 
> Suppose we are using this tool at sever side. We have set up the php page so that all request will be saved in a db. And based on the conditions in request a pdf CAN be generated by this tool. My question is how will we give the trigger for generating this pdf? We cant do it in the php script due to the timeout problem. The only solution i can think of is a cron which is repeated every 5 min or so which fetches records from the db and generates the pdf. But even with a cron we will face the timeout problem. Is there any alternative to a cron like a server side service or something?
> 
> 
> Midhun Girish
------------------
	As I understand it, the "server-side" timeout can be increased in the php.ini setting. So the PHP script can run as long as required if that is set sufficiently high enough. As long as you send something to the browser to confirm that the process has started, the browser-side timeout will not be a problem and your user will know to wait until notified by email that the file is ready. Once the script has completed, it stores the final db record and sends the email.

George

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux