I implemented the laraveldaily invoice package, but recently I've had issues generating PDFs and I get the following error:
[2021-07-16 21:46:31] .ERROR: file_put_contents(/tmp/log.htm): failed to open stream:
Permission denied {"exception":"[object] (ErrorException(code: 0): file_put_contents(/tmp/log.htm):
failed to open stream: Permission denied at /path/to/my/laravel/project/vendor/dompdf/dompdf/src/Dompdf.php:880)
[stacktrace]
So the first thing I did was I went into vendor and edited the following line in the Dompdf Options.php file:
You should never modify the vendor folder, as the next time you update using composer, your changes will be overwritten.
The laravel-invoices package uses the barryvdh/laravel-dompdf package, which of course, uses Dompdf. You should be able to set the temp directory within the Dompdf configuration options.
Hi there @talinon !
Thanks so much for taking the time to reply to this.
The weird thing is my project has no dompdf.php file outside the vendor folder. The barryvdh/laravel-dompdf package uses it, but do I need to publish something in order to gain access to the dompdf.php config file?
If you run php artisan vendor:publish you should be able to find a Provider option for Barryvdh\DomPDF\ServiceProvider. Run that, and it should publish the dompdf.php within your config directory
But, Snapey is probably on the right track thinking it's file permission related. If you configure the path to a sub-directory under your app's Storage directory, make sure both your webserver and the account that runs the artisan command both have permission.