Joe Wilson
Joe Wilson

Reputation: 55

mPDF error: Unable to create output file: ../../../tmp/

I have the issue "Unable to create output file:" when output pdf using mPDF in php,

directory that I want to save the pdf is: /opt/lampp/htdocs/sim/tmp

this is my output pdf:

$fileName = "example.pdf"
$mpdf->Output("../../../tmp/". $fileName,'F');

I tried to change the directory but not working:

$mpdf->Output("/opt/lampp/htdocs/sim/tmp/". $fileName,'F');
$mpdf->Output($_SERVER['DOCUMENT_ROOT']."/sim/tmp/". $fileName,'F');

Tell me if you know the answer..

Upvotes: 1

Views: 2350

Answers (2)

Nageen
Nageen

Reputation: 1759

$mpdf->showImageErrors = true;

You can check your error and resolve it.

Upvotes: 0

d g
d g

Reputation: 1604

Either the directory path does not exist or there are insuffient permissions for the user who is running the php script.

Confirm the directory exists and has the proper permissions:

ls -ld /opt/lampp/htdocs/sim/tmp/

Be sure rwx is set for the user/group of the user whose running the php script.

If the permissions are incorrect you can run:

chown <USER> /opt/lampp/htdocs/sim/tmp/
chmod 755 /opt/lampp/htdocs/sim/tmp/

Where <USER> is the php user.

If you do not have the permissions to change this, you should create a directory in another location, set the permissions accordingly and use that as your PDF save directory.

Upvotes: 1

Related Questions