简体   繁体   中英

Blank page when PHP encounters errors

While I was creating a PHP page, it is always irritating to hit into a blank page when testing (should be a php error somewhere). How do I get it to spill whatever errors in PHP that may have occurred ?

The source code links:

The problem I am facing is that after adding session in both php files to handle and highlight empty fields in HTML forms, the entire addbookmarks.php just went blank when it is being run and tested.

Sorry for the long lines of codes. The suggestions to use codes to enable showing of error did not do anything at all. The page is still blank.

put this at the beginning of the php script
error_reporting(E_ALL);
ini_set('display_errors', '1');

Use this only in development. When you go to production you should remove them and log your errors to a file

From the PHP documentation:

// Report all PHP errors (see changelog)
error_reporting(E_ALL);

// Same as error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);

Or, as goreSplatter says, this should do it:

ini_set('display_errors',1)

Try putting that at the top of your scripts. These commands will set PHP to show all errors from that script during runtime.

Thanks,

James

You should read the manual page with details on error reporting


EDIT : on your addbookmark.php , you don't have error_reporting etc... Putting it in one file won't set it for the others.

Anyway, if you have access to your php.ini, you can set it for every page...

maybe you redirect to other page or your request page show some data and php program have bug and cant complete data... trace your program with print or exit() or var_dump()

also you can use

error_reporting(E_ALL);

of course best way is use error handler

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