Jump to content

Archived

This topic is now archived and is closed to further replies.

Mateobus

PHP display errors

Recommended Posts

I am trying to configure my php.ini file so that it displays error. I am not too familiar with this file, but i think that these two lines have someithing to do with displaying errors:

error_reporting = E_ALL & ~E_NOTICE
display_errors = On

is there any other reason why errors would not display?

Share this post


Link to post
Share on other sites
That all depends on how you write your script
if you dont tell it to show error if failed then it will not show anything.

Share this post


Link to post
Share on other sites
How do i tell it to show errors then. Also, I have written hundreds of scripts where it showed me errors without me explicitly telling it to do so.

Share this post


Link to post
Share on other sites
Well I know on my php server I'm running on my pc for ofline viewing I have to uses the "or die()" statement to get any errors.

Share this post


Link to post
Share on other sites
Try something like this:
[code]<?php

if($var == bla)
  echo "var is bla";
}

?>[/code]
Obviously I have deliberatly leftout the opening curly bracket to force an error inbthe code. You should get an error like the following:
Parse error: parse error, unexpected '}' in path/to/your/file/here]on line 5

If you mean notice errors, which are not errors. You'll want to remove [b]& ~E_NOTICE[/b] from the error_reporting directive in the php.ini

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.