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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/ 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515210 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515212 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515213 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515217 Share on other sites More sharing options...
p2grace Posted April 11, 2008 Share Posted April 11, 2008 PHP won't work without it Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515220 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? Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515221 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 Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515222 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515253 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515254 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? Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515256 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515258 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 />"; } ?> Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515259 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 Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515260 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. Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515264 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 Link to comment https://forums.phpfreaks.com/topic/100733-how-do-i-show-the-errors-in-the-browser/#findComment-515265 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.