ballhogjoni Posted April 11, 2008 Share Posted April 11, 2008 How do I show the errors in the browser? I was thinking of adding this: error_reporting(E_ALL); to the code but nothing shows in the browser when I use it. Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 The errors will only show up if there isn't a syntax issue. If the php page cannot be parsed because of a syntax issue then the errors cannot be generated on the page. Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted April 11, 2008 Share Posted April 11, 2008 good point. if error reporting is turned off in php.ini, even syntax errors won't be displayed. you'd have to update php.ini to set error_reporting if your code isn't compiling. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 11, 2008 Author Share Posted April 11, 2008 You mean it won't tell me where the syntax error is? I hate that I have to go view the errors logs on my server. I wish they would just print out to the browser. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 11, 2008 Author Share Posted April 11, 2008 good point. if error reporting is turned off in php.ini, even syntax errors won't be displayed. you'd have to update php.ini to set error_reporting if your code isn't compiling. I don't have a php.ini file that I know of. Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 PHP won't work without it Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 11, 2008 Author Share Posted April 11, 2008 lol...is there a specific location for it? where do I find it? Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 Is it a linux box? /etc/php.ini Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 11, 2008 Author Share Posted April 11, 2008 I don't have access to it because I am on shared hosting. Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 Hmm well then in that case I think I'd write a php script that echos the last 10 lines of the error log onto a secured administration page somewhere so you don't have to keep going back and looking at the log, you can just refresh a page to view the error. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted April 11, 2008 Author Share Posted April 11, 2008 well, well, well, thats a great idea. how the heck do I do that? Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 11, 2008 Share Posted April 11, 2008 Solve this the easy way. Add the following two lines to your script - ini_set ("display_errors", "1"); error_reporting(E_ALL); This will show everything but fatal parse errors. If you are getting fatal parse errors, they will show up in the web server log file. However, if you are just writing code and it has fatal parse errors, you should be debugging it on a local development computer and not a live server. Your code should be error free before you put it onto a live server. Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 Hmm something like this should do the trick I think: <?php $error_log = file("error_log_location.log"); $counter = 0; $error_log = array_reverse($error_log); for($i=0;$i<10;$i++){ echo $error_log[$i]."<br />"; } ?> Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 Solve this the easy way. Add the following two lines to your script - ini_set ("display_errors", "1"); error_reporting(E_ALL); This will show everything but fatal parse errors. If you are getting fatal parse errors, they will show up in the web server log file. However, if you are just writing code and it has fatal parse errors, you should be debugging it on a local development computer and not a live server. Your code should be error free before you put it onto a live server. Yeup we already discussed this, we're displaying fatal errors Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 11, 2008 Share Posted April 11, 2008 From the posted information, no one knows for a fact what type of errors are occurring. Turning on full php error_reporting and display_errors in a .htaccess file (when php is running as an Apache server module) or in a local php.ini (when php is running as a CGI wrapper) will help more directly with debugging. Code that is experiencing a problem serious enough there there is no output from it is not ready to be put onto a live server. Quote Link to comment Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 No argument there, I was simply giving him the information he requested 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.