Warning: file_put_contents(php_Times-Bold.afm) failed to open stream: Permission denied

452 views
Skip to first unread message

Andy

unread,
Mar 19, 2010, 4:58:51 PM3/19/10
to dompdf
I have a pdf that is being generated on the fly and seems to be
working great, except that some users started telling me that they
can't read it because it's a bunch of random chars.
One of them finally sent me a printout, and right up at the top is a
warning that basically says
Warning: file_put_contents(php_Times-Bold.afm) failed to open stream:
Permission denied in class.pdf.php on line 2354.
The problem seems to go away when the user upgrades their acrobat to
the latest version, but I would like to find the root cause so that I
don't have to worry about it in the future.
Unfortunately I can't get any of my computers to show me this error.

Anything I can do to make this go away?

BrianS

unread,
Mar 19, 2010, 9:04:20 PM3/19/10
to dompdf

DOMPDF 0.6.0 caches a PHP-ized version of the font metrics to speed up
font processing. By default it stores these files in the dompdf/lib/
fonts folder. If the web server doesn't have write access to this
folder then that particular error will be encountered. If you don't
want to give the web server write access to that particular folder you
can specify a different folder by modifying the value of
DOMPDF_FONT_CACHE in you dompdf_config.inc.php.

I think for the final release we'll add a check to make sure the font
cache file can be written.

Message has been deleted

Andy

unread,
Mar 22, 2010, 10:38:50 AM3/22/10
to dompdf

Hmm, well, I set the write access on the whole folder, hopefully
that'll fix it then. It just seems strange that it worked for some
people and not others.
it would be nice if there was a warning or a "is everything set
correctly" page that could be included.
Seems like something simple like:

<?
include("dompdf_config.inc.php");

if(is_writable(DOMPDF_FONT_DIR)){
echo "Passed = Font directory is writable";
} else {
echo "Failed = Font directory is not writable";
}
?>

would work.

Thanks for the help.

Reply all
Reply to author
Forward
0 new messages