I'm getting this error in my laravel application. Mpdf \ MpdfException (E_ERROR) Temporary files directory "/var/www/html/../temp/" is not writable
Please anybody tell me the solution to fix this issue.
I'm getting this error in my laravel application. Mpdf \ MpdfException (E_ERROR) Temporary files directory "/var/www/html/../temp/" is not writable
Please anybody tell me the solution to fix this issue.
I fixed it like so:
$mpdf = New \Mpdf\Mpdf(['tempDir'=>storage_path('tempdir')]);
storage_path('tempdir')
is the laravel-managed temporary directory.
I solved my issue by specifying tempDir to a usable temp directory
In config/pdf.php
<?php
return [
'mode' => 'utf-8',
'format' => 'A4',
'author' => '',
'subject' => '',
'keywords' => '',
'creator' => 'Laravel Pdf',
'display_mode' => 'fullpage',
'tempDir' => base_path('storage/app/mpdf'),
'pdf_a' => false,
'pdf_a_auto' => false,
'icc_profile_path' => ''
];
if you are not found config/pdf.php then you should publish package's config file to your config directory by using following command:
php artisan vendor:publish
If you are using docker, and having trouble to give the permissions make sure to enter in the docker container with root user using the follow command:
docker container exec -u 0 -it yourContainer bash
From this answer: Root password inside a Docker container