简体   繁体   English

为什么DomPdf在共享托管上可以正常工作,但在VPS托管上却不能正常工作?

[英]why DomPdf is working fine on shared hosting but not on VPS hosting?

I'm making a website in PHP in which I m using the DOMPDF. 我正在用PHP创建一个使用DOMPDF的网站。 I have the same website hosted on two servers one is shared and other is VPS(centos). 我在两个服务器上托管了相同的网站,一个是共享的,另一个是VPS(centos)。 DomPDF is working fine on shared hosting but showing blank white page in vps server here is my code DomPDF在共享主机上工作正常,但是在vps服务器中显示空白页面,这是我的代码

require_once("admin/dompdf/autoload.inc.php");
echo "<pre>" ; print_r(__DIR__ ); echo " 1 </pre>";
use Dompdf\Dompdf;
echo "<pre>" ; print_r(__DIR__ ); echo " 2 </pre>";

$dompdf = new Dompdf();
echo "<pre>" ; print_r(__DIR__ ); echo " 3 </pre>";
$dompdf->loadHtml($template);

$dompdf->setPaper('A4','landscape');

$dompdf->render();
$dompdf->stream(); 

I tried to echo. 我试图回声。 working fine till echo 2 but echo 3 is not displaying means the problem is in line $dompdf = new Dompdf(); 正常工作,直到回显2,但未显示回显3意味着问题在$dompdf = new Dompdf();

You can check the requirements for DomPDF here: https://github.com/dompdf/dompdf/wiki/Requirements 您可以在此处查看DomPDF的要求: https//github.com/dompdf/dompdf/wiki/Requirements

You are probably missing one of the required extensions. 您可能缺少所需的扩展名之一。 (MBString or GD) (MBString或GD)

You can check your enabled modules with the php -m command. 您可以使用php -m命令检查启用的模块。
Also check this question: How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS? 还要检查以下问题: 如何检查在Ubuntu Linux 12.04 LTS中已启用/禁用了哪些PHP扩展?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM