用PHP创建PDF文件

I need to create a temp PDF file in PHP, and read it out. But I got the error, it means there is no file existing.

PHP Notice:  Undefined index: HTTP_HOST in /home/apache/htdocs/consreports/consrpt_conf.php on line 78
PHP Warning:  fopen(/home/apache/htdocs/reports/tempt.pdf): failed to open stream: No such file or directory in /home/apache/htdocs/consreports/ids_buildsrcipxmlreport.php on line 146
PHP Warning:  filesize(): stat failed for /home/apache/htdocs/reports/tempt.pdf in /home/apache/htdocs/consreports/ids_buildsrcipxmlreport.php on line 147
PHP Warning:  fread() expects parameter 1 to be resource, boolean given in /home/apache/htdocs/consreports/ids_buildsrcipxmlreport.php on line 147
PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/apache/htdocs/consreports/ids_buildsrcipxmlreport.php on line 148
PHP Warning:  unlink(/home/apache/htdocs/reports/tempt.pdf): No such file or directory in /home/apache/htdocs/consreports/ids_buildsrcipxmlreport.php on line 150

My code as follows:

passthru("htmldoc --no-localfiles --no-compression -t pdf14 --quiet --jpeg --browserwidth 1100 --webpage ".
          "--color --linkcolor 000099 --bodyfont Sans-Serif --fontsize 8 ".
          " --landscape --header ct --footer ..: --headfootfont Sans-Serif --headfootsize 8 --size Letter ".
          " -f ".$reportdir."tempt.pdf ".
          " https://".$urlbase."rpt_pdfwrapper.php?reportid=".$reportid);

//get the base64 encoded pdf file
$handle = fopen($reportdir."tempt.pdf","r");
$file_content = fread($handle,filesize($reportdir."tempt.pdf"));
fclose($handle);
$srctoprptpdf = base64_encode($file_content);
unlink ($reportdir."tempt.pdf");

Thanks for any help and comment.