Jump to content

Php Error Messages


willy-t
 Share

Recommended Posts

I noticed that php scripts don't display very helpful eror messages when they are running on my tch server. In fact, most of the time, an error that would raise a message on my home computer will generate only a blank screen on tch.

 

I think this is great for production sites. But when I'm trying to test and debug scripts, it gets to be hard when all i get is a blank screen instead of the customary error message and line number.

 

Is there any way for me to change the settings for certain scripts or my whole account so that I can get descriptive php error messages?

 

Any help would be appreciated,

 

Thanks,

-kyle-

Link to comment
Share on other sites

shouldn't you be able to write some php code to turn error reporting on or off?

 

That's exactly what I'm looking for. I tried a few commands off the php website but they wouldn't take. And, ironically, I couldn't get too far because I don't get much feed back without error reporting.

Link to comment
Share on other sites

Personally, I don't like to turn error reporting on and off via .htaccess. The problem with this method is that I have to modify this file every time I need to debug something.

 

I just thought that an alternative method would be to include something like in the php file

 

if ($_GET['debug']) ini_set('display_errors', '1');

else ini_set('display_errors', '0');

 

This way you can turn debugging on and off at any time, by just adding

?debug=something to the URL.

Link to comment
Share on other sites

I stole my comment from a post Rick made. I couldn't remember the exact resolution so I did a search in the forums.

 

vangrieg, that may be an alternative but for me I am not sure I can remember to type that at the end or to include it in the code. Getting older I have a hard time remembering things. For me it takes 2 seconds in cPanel to modify the file. But hey, if it works then whatever is easiest right?

Link to comment
Share on other sites

vangrieg, you don't like to leave PGP error reporting on all the time? If so... why?

You mean PHP error reporting? Sometimes errors aren't serious enough to prevent visitors from using the site normally, but error reports still show up, messing up the layout. Moreover, the error reports can give away some paths and file names, which may pose certain security risks.

Link to comment
Share on other sites

Mm. I see your point. Yes, I meant PHP, lol... Typo daemon got ahold of me.

 

Yes, security is indeed an issue, and it can mess up the layout... I build my websites that all the PHP-intensive stuff is executed before the HTML even begins, so any error messages precede the html coding.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...