barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.57k stars 965 forks source link

Laravel Unable to create directory: /tmp #1012

Open HashmatWaziri opened 7 months ago

HashmatWaziri commented 7 months ago

` $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);`

dompdf error

HashmatWaziri commented 7 months ago

@ericvanjohnson @jdavidbakr @zaherg @luke83 , Wanted to follow up on this matter. thanks.

HashmatWaziri commented 7 months ago

@jdavidbakr @zaherg @luke83 @ericvanjohnson , wanted to follo up on this

jdavidbakr commented 7 months ago

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?

HashmatWaziri commented 7 months ago

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