Closed Daniel-FDS closed 1 year ago
Hi @Daniel-FDS ,
the timeout of WeasyPrint command is managed by Symfony Process component, it should just work.
To increase the timeout you can set its value using the setTimeout
method:
$pdf = new Pdf('/usr/local/bin/weasyprint');
$pdf->setTimeout(60); //set timeout to one minute
To further debug your issue you can attach a Psr\Log\LoggerInterface
compatible logger (like Monolog) with setLogger()
method:
use MonologLogger;
use MonologHandlerStreamHandler;
$logger = new Logger('logger');
$logger->pushHandler(new StreamHandler(__DIR__ . '/weasyprint.log', Logger::DEBUG));
$pdf = new Pdf('/usr/local/bin/weasyprint');
$pdf->setTimeout(60); //set timeout to one minute
$pdf->setLogger($logger);
Hi Manuel
Thank you so much for your reply, I appreciate it. Both the timeout increase and the logging will be very helpful in this case. I will try and report if anything noteworthy arises hereafter.
Thank you once again 🙏🏼
On Wed, Jun 14, 2023, 18:31 Manuel Dalla Lana @.***> wrote:
Hi @Daniel-FDS https://github.com/Daniel-FDS , the timeout of WeasyPrint command is managed by Symfony Process component, it should just work. To increase the timeout you can set its value using the setTimeout method:
$pdf = new Pdf('/usr/local/bin/weasyprint');$pdf->setTimeout(60); //set timeout to one minute
To further debug your issue you can attach a Psr\Log\LoggerInterface compatible logger (like Monolog) with setLogger() method:
use MonologLogger;use MonologHandlerStreamHandler; $logger = new Logger('logger');$logger->pushHandler(new StreamHandler(DIR . '/weasyprint.log', Logger::DEBUG)); $pdf = new Pdf('/usr/local/bin/weasyprint');$pdf->setTimeout(60); //set timeout to one minute$pdf->setLogger($logger);
— Reply to this email directly, view it on GitHub https://github.com/pontedilana/php-weasyprint/issues/10#issuecomment-1591610778, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBIKXPZRYGRV2OZJHQ2CUTXLHRM3ANCNFSM6AAAAAAZGPFAXY . You are receiving this because you were mentioned.Message ID: @.***>
Good day
I have a Codeigniter PHP web app that implements php-weasyprint. I sometimes (5% of the time) get the following error when a user generates a document:
The process "/usr/local/bin/weasyprint '/tmp/php_weasyprint6489782e31d4e8.37601559.html' '.../d9cb68c13f6489782e30fcf.pdf'" exceeded the timeout of 10 seconds.
I cannot seem to see why this happens. It is also interesting, because when the error appears, it is almost immediately after the quotation generation has been initiated, not 10 seconds later.
Is there any reason why this could be happening? I am not sure what code to share, but at least this is my document generator function:
`
`