开发者

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:

  • http://ahb.me/15aR (addbookmarks.php)
  • http://ahb.me/15aU (managebookmarks.php)

The problem I am facing is that after adding session i开发者_如何学JAVAn 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


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


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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜