When generating PDF with dompdf I am having this problem in pdf file when viewing file in notepad

Warning : tempnam() [function.tempnam]: SAFE MODE Restriction in effect. The script whose uid is 10210 is not allowed to access /tmp owned by uid 0 in /var/www/vhosts/www.mysite.com/httpdocs/wp-content/themes/mysite/dompdf/include/image_cache.cls.php on line 105

Warning: file_put_contents() [function.file-put-contents]: Filename cannot be empty in /var/www/vhosts/www.mysite.com/httpdocs/wp-content/themes/mysite/dompdf/include/image_cache.cls.php on line 117

Warning: unlink() [function.unlink]: Unable to access in /var/www/vhosts/www.mysite.com/httpdocs/wp-content/themes/mysite/dompdf/include/image_cache.cls.php on line 153 Blockquote

I have included image in pdf file. Without image this message is not displayed. I have tried with absolute and relative path of the image also but did not work. I have set the folder permission to 777 to dompdf folder. Need help on this matter.

Thanks in advance

  • 1
    You should rename the title of your question to something comprehensible.
    – mike23
    Jun 8, 2011 at 9:51

2 Answers 2


Turn off PHP Safe Mode, or get your host to do it for you. Lots and lots of things won't work in safe mode.

C'mon. Live on the edge. That's where the fun is. :)


In dompdf_config.inc.php file there is a line

//define("DOMPDF_TEMP_DIR", "/tmp");

I changed this as define("DOMPDF_TEMP_DIR", DOMPDF_DIR."/tmp"); and created folder tmp within folder dompdf and this worked for me.

Thank you all for your concern :)

  • Hi user478, thanks for answering your own question, you just saved me several hours with this fix :-) Jan 3, 2012 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.