1
votes

Today our web server started throwing these errors when generating a pdf with php-pdf. Path is wrong but the pdf still generates. Unsure why this path issue started or how to fix it. Also concerned that it just started seemingly on its own.

Warning: fopen(/tmp/cachedTimes-Roman.php) [function.fopen]: failed to open stream: Permission denied in /home/site/public_html/include/pdf-php/src/Cpdf.php on line 2039

Warning: fwrite() expects parameter 1 to be resource, boolean given in /home/site/public_html/include/pdf-php/src/Cpdf.php on line 2040

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/site/public_html/include/pdf-php/src/Cpdf.php on line 2041

2
You might get some inspiration there : stackoverflow.com/questions/36577020/…Vic Seedoubleyew

2 Answers

0
votes

Most likely the device where /tmp is may have run out of space, so that new files can not be created there.

df -h in console should get you started.

If you are the system administrator, even rm -rf /tmp/* might help, but may also have consequences if any files currently in use are stored there.

0
votes

The warnings were caused by the script not being able to find the font files. The problem was solved by explicitly setting the tempPath.

$pdf->tempPath = '../include/pdf-php/src/fonts';