laravel-dompdf
laravel-dompdf copied to clipboard
Laravel Unable to create directory: /tmp
` $pdf = PDF::loadView('education::classes.reports.pdf.student.memorization', $data)->setPaper('a4');
// Get the current time, but only the hour, minute, and second
// Define file path and name without the time component
$filename = "student_memorization_report_{$month}_{$year}.pdf";
$filePath = storage_path('app/public/reports/' . $filename);
// Check if a file with the same name already exists, delete if it does
if (file_exists($filePath)) {
unlink($filePath);
}
$pdf->save($filePath);`
@ericvanjohnson @jdavidbakr @zaherg @luke83 , Wanted to follow up on this matter. thanks.
@jdavidbakr @zaherg @luke83 @ericvanjohnson , wanted to follo up on this
I'm unclear why you tagged me? Looks like it may be a filesystem issue, does the /tmp directory exist in your environment and is it writable by the web service?
I appologize if wrongly tagged but yeah it is writable by the web service . I am using ubunto for production. here is the details of the tmp folder : drwxrwxrwx 11 root root 409600 Dec 2 08:10 tmp I already changed the root root to the web services one but still got error. Anather point is that I already changed the "temp_dir" => storage_path('app/dompdf_temp'), of the dompdf but it is not reflected as it keeps giving me that error
The same here. Overriding the temp_dir in dompdf.php does override the config variable but the loadHTML method is still pointing to /tmp directory. Is there any method or config to fix this ?
This is what does the job in my case $pdf->setOptions(['logOutputFile' => storage_path('app/dompdf/' . 'index.html')] )