简体   繁体   中英

Blank page on PHP (7.3.9) using Xampp 3.2.4

So I am using xampp as my server hosting, and haven't got a problem in years. But I found something strange happening.

I have this code:

require "init.php";
require_once('vendor/autoload.php');

$pdf = new TCPDF("P", "mm", 'A4', true, 'UTF-8', false);

var_dump($pdf);

If I execute this code. My page is fully blank? And sometimes it isn't. Like so:

在此处输入图片说明

But when I execute my page in a command line, like so:

c:\xampp\php\php.exe C:\xampp\htdocs\websites\Traject-Parket\index.php

I get the var_dump I wrote.

在此处输入图片说明

So I have no errors whats so ever? How come my page is blank and sometimes isn't? Because in this project nothing seems to work but in other projects it does.

Blank pages (or WSOD, white screen of death) is when your script fails. You don;'t have display_errors turned on, so at the top of your script, you can say:

ini_set('display_errors', true);
error_reporting(-1);

And that will allow you to see the error.

However, it isn't the best way. Error logging directly to the screen not onl;y distorts your page, but can ruin header() calls, as the HTTP body has already started outputting and thus no more HTTP headers can come out.

For the best error logging experience, set error_reporting to -1, turn display_errors off, and set a custom error_log . Then in the terminal, type tail -f /path/to/error_log . Your notices, warnings and errors will now scroll past in real time, without distorting your web page's display.

I don't know this library, but var_dump shows that unprotected data from PHP 5.6.0.

Maybe the problem comes from there?

Look at the __debugInfo() method

And give us the exit.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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