0

I'm making a website in PHP in which I m using the DOMPDF. I have the same website hosted on two servers one is shared and other is VPS(centos). DomPDF is working fine on shared hosting but showing blank white page in vps server here is my code

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();

mega6382
  • 9,211
  • 17
  • 48
  • 69
bab951
  • 41
  • 12
  • 1
    enable error_reporting: https://stackoverflow.com/a/845025/1194525 You probably do not have any extension required by dompdf – bato3 Oct 10 '17 at 08:46

1 Answers1

0

You can check the requirements for DomPDF here: https://github.com/dompdf/dompdf/wiki/Requirements

You are probably missing one of the required extensions. (MBString or GD)

You can check your enabled modules with the php -m command.
Also check this question: How to check which PHP extensions have been enabled/disabled in Ubuntu Linux 12.04 LTS?

Frank Groot
  • 560
  • 6
  • 21
  • Gd already present i have checked it with php -m but when i tried to install mbstring got the following ** file contain no section header file://etc/yum.repos.d/centOs-repo, line:6 , 'baseurl= http://centos.intergenia.de/6/updates/x86_64/\n** – bab951 Oct 10 '17 at 10:15
  • i have solved the above issue and tried to install mbstring and restarted the server but not able to find the mbstring in phpinfo() – bab951 Oct 10 '17 at 10:59
  • 1
    thanks you Frank Groot Issue has been resolved the missing package was mb-string those who all are facing same issue please check the package using command 'php -m' if the package is not there in the list install it by the following command 'yum install php-mbstring' and check again if the package is still not there and if you are using godaddy server this could be the answer for your problem https://stackoverflow.com/questions/39560930/mbstring-extension-installation-on-godaddy-server – bab951 Oct 10 '17 at 17:31