willy-t Posted January 18, 2004 Share Posted January 18, 2004 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- Quote Link to comment Share on other sites More sharing options...
natimage Posted January 18, 2004 Share Posted January 18, 2004 OK...I'm am not a php expert, and this sounds very rudimentary, but shouldn't you be able to write some php code to turn error reporting on or off? Quote Link to comment Share on other sites More sharing options...
TCH-Rob Posted January 18, 2004 Share Posted January 18, 2004 Add the following commands to your .htaccess file in the folder containing the php script (or create an .htaccess file if none exists.) php_flag display_errors on php_value error_reporting 7 Quote Link to comment Share on other sites More sharing options...
willy-t Posted January 18, 2004 Author Share Posted January 18, 2004 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. Quote Link to comment Share on other sites More sharing options...
natimage Posted January 18, 2004 Share Posted January 18, 2004 You go, Rob!!! Quote Link to comment Share on other sites More sharing options...
vangrieg Posted January 18, 2004 Share Posted January 18, 2004 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. Quote Link to comment Share on other sites More sharing options...
TCH-Rob Posted January 18, 2004 Share Posted January 18, 2004 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? Quote Link to comment Share on other sites More sharing options...
vangrieg Posted January 18, 2004 Share Posted January 18, 2004 But hey, if it works then whatever is easiest right? Absolutely. Cpanel's File Manager is a little slow, that's why I don't like it too much. But otherwise any of the methods does the same thing. Quote Link to comment Share on other sites More sharing options...
DarqFlare Posted January 18, 2004 Share Posted January 18, 2004 vangrieg, you don't like to leave PGP error reporting on all the time? If so... why? Quote Link to comment Share on other sites More sharing options...
vangrieg Posted January 18, 2004 Share Posted January 18, 2004 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. Quote Link to comment Share on other sites More sharing options...
DarqFlare Posted January 18, 2004 Share Posted January 18, 2004 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.