Php wkhtmltopdf不会为Debian创建pdf

Php wkhtmltopdf不会为Debian创建pdf,php,debian,wkhtmltopdf,Php,Debian,Wkhtmltopdf,这是我的PHP代码,我正在使用它将HTML文件转换为pdf,然后从服务器下载pdf文件 wkhtmltopdf $url = base_url().'invoices/'.$file_name.'.html'; exec("wkhtmltopdf-amd64 $url {$file_folder}{$file_name}.pdf"); header("Cache-Control: no-cache"); header("Content-Descripti

这是我的PHP代码,我正在使用它将HTML文件转换为pdf,然后从服务器下载pdf文件

wkhtmltopdf

$url = base_url().'invoices/'.$file_name.'.html';                    
exec("wkhtmltopdf-amd64 $url {$file_folder}{$file_name}.pdf");

header("Cache-Control: no-cache");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file_name.pdf");
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
$pdfFile = base_url().'invoices/'.$file_name.'.pdf';
readfile($pdfFile);
&执行exec后(“wkhtmltopdf-amd64$url{$file_folder}{$file_name}.pdf”);它不会在文件夹中创建pdf文件

Ubuntu上运行良好,但在下载pdf后,在Debian上运行时,打开pdf Adob Reader时显示错误,请查看图片

我认为这个问题是由于exec()没有在Debian中工作造成的


检查base_url()中的路径是否在下载文件时传递了正确的路径,
为了测试这一点,在浏览器中写下路径并检查它是否被下载

对于Debian,我需要安装xvfb运行wkhtmltopdf

ulr指向正确,很抱歉,我正在使用wkhtmltopdf&after execute exec(“wkhtmltopdf-amd64$url{$file_folder}{$file_name}.pdf”);它不会在文件夹中创建pdf文件。如果没有提供正确格式的文件,则会发生这种情况。对于wkhtmltopdf,这可能有助于
$url = base_url().'invoices/'.$file_name.'.html';                    
exec("wkhtmltopdf-amd64 $url {$file_folder}{$file_name}.pdf");

header("Cache-Control: no-cache");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=$file_name.pdf");
header("Content-Type: application/pdf");
header("Content-Transfer-Encoding: binary");
$pdfFile = base_url().'invoices/'.$file_name.'.pdf';
readfile($pdfFile);