Reputation: 70
I've looked at multiple tutorials on the matter and apparently MPDF is a simple as can be.
<?php
require_once('tools/mpdf.php');
$mpdf = new mPDF();
$mpdf->WriteHTML('<p>Your first taste of creating PDF from HTML</p>');
$mpdf->Output();
exit;
?>
Obviously I'm going to build on top of this but I can't even get the basics working for some reason. All I get is a "500 Internal Server Error". I've stripped the file down to just
<?php
require_once('tools/mpdf.php');
?>
And I get that error. I've ensured that the mpdf.php file is in the tools directory and properly loaded onto my server, so there's no issue there..
Any ideas?
Upvotes: 4
Views: 8363
Reputation: 71
I was having this issue and found a simple solution. Mpdf worked well on my local machine but I had the trouble when using it on a remote server.
If anyone else is having the same issue when deploying your app on a remote server.
"Exceptioncaught Mpdf\\MpdfException: Temporary files directory.... is not writeable"
chmod 777 /vendor/mpdf/mpdf/tmp
, which I do not recommend because it would give read, write and execute permission to the owner, group and publicchown www:www /vendor/mpdf/mpdf/tmp
It worked for me, I hope it can help others.
Upvotes: 7
Reputation: 1
I had the same problem, I was desperate in the end but I deleted tmp sub-folder from mpdf folder and it started working.
Upvotes: 0