Maximum execution time of 300 seconds exceeded in /path/to/whmcs/vendor/tecnickcom/tcpdf/tcpdf.php
Symptom
When generating a PDF invoice or quote (for example, during the daily automation cron tasks) you may encounter a maximum execution time exceeded
fatal error:
Maximum execution time of 300 seconds exceeded in /path/to/whmcs/vendor/tecnickcom/tcpdf/tcpdf.php
Cause
This error may be due to a high-resolution logo image in the PDF file, increasing the necessary amount of time to generate the PDF file above the specified PHP max_execution_time
configuration.
Solution
To resolve this issue, resize the logo image to smaller dimensions and reduce the filesize.
- The logo image normally exists at
/assets/img/logo.png
or/assets/img/logo.jpg
. - A logo with dimensions of
300
x100
pixels is usually sufficient.
After you resize the image, upload the smaller logo image, overwriting the original larger logo image file.
If you have a customized PDF template, the logo image may have a different filename or location. Review the invoicepdf.tpl
and quotepdf.tpl
code to confirm whether the filename and folder path are customized and, if they are, adjust them accordingly.