+ 1
Problem with localhost Path, XAMPP and TCPDF
Hi all, I use TCPDF to generate a PDF in PHP. When I use the $pdf->Output($file_total, 'I'); its all good and the file is shown in Browser. If I use the save to localhost option $pdf->Output($file_total, 'F'); I get this error: "failed to open stream: Permission denied in /opt/lampp/htdocs/project/tcpdf_min/include/tcpdf_static.php on line 1821" "TCPDF ERROR: Unable to create output file" The Path I set for saving the PDF file is: "/opt/lampp/htdocs/project/files/2021" What am I doing wrong? is my path wrong? Thanks
6 Answers
+ 1
Ok, so here is the answer. There were two mistakes:
1) the path: on mac the path to xampp/lampp folder is âhttp://localhost:8080/name_of_your_folder_in_htdocsâŠâ
2) the problem with tcpdf not able to generate output was because all folders in xampp/lampp were by default read only. So i just had to change the permissions of all folders to âeveryone - read AND writeâ.
So thats it
+ 1
$pdf->Output($_SERVER['DOCUMENT_ROOT'] . 'output.pdf', 'F'); ?
+ 1
have you checked the folder permissions? I don't really have any more ideas
+ 1
Alexey Kopyshev i did and that was the part 2 of the problem. Thanks man. Now its solved
0
Alexey Kopyshev, it's not working for me. I just add the path as "/opt/lampp/htdocs" and then I still get the error:
Warning: fopen(file:///opt/lampp/htdocs/output.pdf): failed to open stream: Permission denied in /opt/lampp/htdocs/project/tcpdf_min/include/tcpdf_static.php on line 1821
TCPDF ERROR: Unable to create output file: /opt/lampp/htdocs/output.pdf
Something is wrong with the path... forced save ("D") works, but i need to save the file in particular folder... any ideas?!
0
Alexey Kopyshev so im the half way throug it - the path is âhttp://locahost:8080/projectâŠâ But i still get the error âunable to create output fileâŠâ any ideas?!