LLLLLLL Posted June 22, 2011 Share Posted June 22, 2011 OK, I thought I understood the error logging settings, but I don't quite understand. Trying to troubleshoot another friend's site, a page had a fatal error so it didn't load. The browser returned a "page not found" type of error. We enabled the log and found the issue and corrected it. However, on my own machine, I tried to attempt this same bad behavior and I always see the error: Fatal error: Call to undefined function foo() in /(path)/header.php on line 4 Why would my server show the error, but his server treated the page as if it did not exist? For the record, the entire page had this content <?php include( 'includes/header.php' ); ?> The error is caused because header.php calls a function that hasn't been defined. I'm just wondering why there is a difference of error handling. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/ Share on other sites More sharing options...
fugix Posted June 22, 2011 Share Posted June 22, 2011 do you both have a directory called "includes" with a file called header.php in it Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233527 Share on other sites More sharing options...
rbrown Posted June 22, 2011 Share Posted June 22, 2011 It has to do with the differences between the way the two servers are setup to handle the error. On a Production server you don't want to showendusers the true error otherwise it can help hackers and kiddiescripters on your dirs structure, filenames, naming conventions, possible software you are running, etc... so they can break in to your site. On a Development server you turn all the error checking on so you can see where you have a problem. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233530 Share on other sites More sharing options...
fugix Posted June 22, 2011 Share Posted June 22, 2011 depends on what each servers error_reporting and display_error settings are. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233534 Share on other sites More sharing options...
LLLLLLL Posted June 22, 2011 Author Share Posted June 22, 2011 Yes, rbrown, that is my question: what are these relevant settings? The environments are the same; only the error handling was different. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233537 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 Well even the web host is unsure how they get this type of error to show a 500 error: The website encountered an error while retrieving http://somesite/intentionalbadpage. It may be down for maintenance or configured incorrectly. Here are some suggestions: Reload this web page later. HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfill the request. I like this type of error handling, but don't know how to get it set up! Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233806 Share on other sites More sharing options...
wildteen88 Posted June 23, 2011 Share Posted June 23, 2011 You need to configure PHP so the settings error_reporting is set to E_ALL and display_errors is set to On within the php.ini You can also enable these settings within your scripts(s) using error_reporting(E_ALL); ini_set('display_errors', 1); Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233933 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 But this just suppresses the errors, it doesn't cause a browser 500 error. That's the ultimate mystery I'm trying to solve. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233938 Share on other sites More sharing options...
wildteen88 Posted June 23, 2011 Share Posted June 23, 2011 But this just suppresses the errors, it doesn't cause a browser 500 error. That's the ultimate mystery I'm trying to solve. It does not suppress the error messages. It will display the errors during run time. When display_errors is not enabled (this is the setting which display the errors) you will either get a 500 Internal Error Message or a blank screen. When an error occurs they will be logged to the servers error log. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233939 Share on other sites More sharing options...
efficacious Posted June 23, 2011 Share Posted June 23, 2011 lol i virtually have this same issue right now... haha cept i'm not in control of the erroneous server Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233940 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 you will either get a 500 Internal Error Message or a blank screen. What determines the 500 or blank screen? Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233941 Share on other sites More sharing options...
wildteen88 Posted June 23, 2011 Share Posted June 23, 2011 When an error occurs within your code. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233943 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 No no no.... I'm asking why would a blank screen display, versus a 500 error. This is what I've been trying to understand during this entire thread. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233944 Share on other sites More sharing options...
fugix Posted June 23, 2011 Share Posted June 23, 2011 A blank screen is normally caused by a syntax error in your code, a 500 error is an internal server error. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233950 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 As discussed, the code on both servers is identical. It is the same intentionally-flawed code. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233951 Share on other sites More sharing options...
efficacious Posted June 23, 2011 Share Posted June 23, 2011 i read somewhere during my searches on google for internal server errors (500 error) could show blank displays or the 500error Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233953 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 Yes, but my entire question on this thread is why 500 vs. blank screen. It must be an environmental setting somewhere, but which setting?? Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233954 Share on other sites More sharing options...
wildteen88 Posted June 23, 2011 Share Posted June 23, 2011 I'm not sure myself but I think a 500 Internal Error message is caused when PHP is running as CGI. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233959 Share on other sites More sharing options...
LLLLLLL Posted June 23, 2011 Author Share Posted June 23, 2011 AH!!!!!!! I think you may have answered it. Bravo to you! I think that's the case with the 500 server. How do I give you a gold star?? Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233962 Share on other sites More sharing options...
efficacious Posted June 23, 2011 Share Posted June 23, 2011 I still don't understand what CGI is sposed to mean, because every explanation i've come across just claims that basically any serverside programming is a CGI. Quote Link to comment https://forums.phpfreaks.com/topic/240150-where-was-the-error/#findComment-1233966 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.