1

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

Mike Volmar
  • 1,927
  • 1
  • 22
  • 31
  • You might get some inspiration there : http://stackoverflow.com/questions/36577020/php-failed-to-open-stream-no-such-file-or-directory – Vic Seedoubleyew Oct 15 '16 at 11:54

2 Answers2

0

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

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';
Mike Volmar
  • 1,927
  • 1
  • 22
  • 31