kurt.santo Posted December 11, 2007 Share Posted December 11, 2007 What is the difference between 401 and 403? Do not get what is difference in between an access where you need authorisation and it is forbidden. I would have thought it is forbidden to access a file where you do not have the right authorisation. Also, error 500 for an internal server error: what could the server error be?Kurt Link to comment Share on other sites More sharing options...
justsomeguy Posted December 11, 2007 Share Posted December 11, 2007 http://www.w3.org/Protocols/HTTP/HTRESP.htmlUnauthorized 401 The parameter to this message gives a specification of authorization schemes which are acceptable. The client should retry the request with a suitable Authorization header.Forbidden 403 The request is for something forbidden. Authorization will not help. Also, error 500 for an internal server error: what could the server error be?Anything. Most 500 errors are caused by an application like PHP or ASP faulting. Link to comment Share on other sites More sharing options...
boen_robot Posted December 11, 2007 Share Posted December 11, 2007 Error 500 can also be because of an error in the server's configuration.In the case of Apache, this could really be "anything" since it's text. IIS on the other hand has a nice GUI, which would prevent most errors from you.Still, things to watch out for are invalid configuration file syntax (in the case of Apache), like for example specifying <Diretcory "C:/"> instead of <Directory "C:/"> or it could be an unorthodox URL rewriting, or a loading of non-existing module, existing but invalid module, etc. etc. etc. Link to comment Share on other sites More sharing options...
kurt.santo Posted December 12, 2007 Author Share Posted December 12, 2007 Cheers! Now I understand...Kurt Link to comment Share on other sites More sharing options...
Skemcin Posted December 12, 2007 Share Posted December 12, 2007 Most 500 Errors that get reported are just a mask for an underlying error. Each browser - mainly IE - has a setting to display friendly error messages. If you really want to see what is going on, make sure your browser has this setting unchecked - it will reveal the actually ASP, PHP, or ColdFusion Error. Link to comment Share on other sites More sharing options...
croatiankid Posted December 12, 2007 Share Posted December 12, 2007 .htaccess could also cause a 500 error to show in the browser. Link to comment Share on other sites More sharing options...
kurt.santo Posted December 13, 2007 Author Share Posted December 13, 2007 .htaccess could also cause a 500 error to show in the browser.I use .htaccess and display a user-friendly message. Kind of easily tested for 404 etc, but not sure how I could test that it works for 500. Also, I use a custom error handler, which redirects to a page with a nice message apologising to the user. Is 500 in this case obsolete (still created 500 as I am not sure)?Kurt Link to comment Share on other sites More sharing options...
boen_robot Posted December 14, 2007 Share Posted December 14, 2007 I use .htaccess and display a user-friendly message. Kind of easily tested for 404 etc, but not sure how I could test that it works for 500. Also, I use a custom error handler, which redirects to a page with a nice message apologising to the user. Is 500 in this case obsolete (still created 500 as I am not sure)?KurtI'm not sure about that one myself. I suppose if the .htaccess file that defines it doesn't trigger error 500 on it's own, you can just say in it:ErrorDocument 500 /path/to/the/error/handler And if .htaccess files in subfolders trigger error 500, then this file would be used.Still, note that syntax errors in PHP won't cause that page to appear. Instead, you'll just see an error message produced by PHP itself... well... if you have adjusted IE not to use the "friendly error messages" view or use another browser you will. Link to comment Share on other sites More sharing options...
kurt.santo Posted December 15, 2007 Author Share Posted December 15, 2007 I'm not sure about that one myself. I suppose if the .htaccess file that defines it doesn't trigger error 500 on it's own, you can just say in it:ErrorDocument 500 /path/to/the/error/handler And if .htaccess files in subfolders trigger error 500, then this file would be used.Still, note that syntax errors in PHP won't cause that page to appear. Instead, you'll just see an error message produced by PHP itself... well... if you have adjusted IE not to use the "friendly error messages" view or use another browser you will. As far as I understood there is nothing you can do about syntax errors. Am I right? I tested the complete site, so hopefully there won't be any such mistakes, but obviously you never know. It is just that the PHP error messages mess up my whole page, so I just pray there won't be any...Kurt Link to comment Share on other sites More sharing options...
boen_robot Posted December 15, 2007 Share Posted December 15, 2007 As far as I understood there is nothing you can do about syntax errors. Am I right? I tested the complete site, so hopefully there won't be any such mistakes, but obviously you never know. It is just that the PHP error messages mess up my whole page, so I just pray there won't be any...KurtRight. You can't do anything about syntax errors in PHP. Fatal errors can also cause error 500, but they can at least be handled with set_error_handler(), unlike syntax errors.BTW, as the manual for that function says, "Also note that it is your responsibility to die() if necessary" . Link to comment Share on other sites More sharing options...
justsomeguy Posted December 17, 2007 Share Posted December 17, 2007 You can always just disable error messages. The user won't know if an error occurred unless you catch it, but they won't see any messages either. Link to comment Share on other sites More sharing options...
kurt.santo Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks all for your input.boen_robot,So I cannot do anything about syntax errors, but as fatal errors can be handled by my error handler I assume the page 500 isn't necessary and I use just my custom error page (correct me if I am wrong). Furthermore, what do you mean by that it is my resonsibility to die? I mean as count dracula I am already dead, bit difficult to die again (unless for real this time);-)justsomeguy,How would I disable error messages on a hosted site? Not sure if I can do this...Kurt Link to comment Share on other sites More sharing options...
justsomeguy Posted December 18, 2007 Share Posted December 18, 2007 ini_set("display_errors", 0);on any page Link to comment Share on other sites More sharing options...
kurt.santo Posted December 19, 2007 Author Share Posted December 19, 2007 ini_set("display_errors", 0);on any pageSo, the user then sees all not PHP-parts of the page if there is an error? And how would the webmaster know that there is an issue with it's site? Would it still log?Kurt Link to comment Share on other sites More sharing options...
boen_robot Posted December 19, 2007 Share Posted December 19, 2007 So, the user then sees all not PHP-parts of the page if there is an error? And how would the webmaster know that there is an issue with it's site? Would it still log?KurtI'm not sure, but I think PHP does log errors by default. Whether you'll have access to those logs however depends on your host. If they can't give you access to those, then you'll have to log the errors yourself using the error handling function passed to set_error_handler(). If they give you access to the error logs, you should use them instead of logging errors yourself, as you'll spare some disk space that way. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 19, 2007 Share Posted December 19, 2007 Look at the configuration options listed on this page:http://www.php.net/manual/en/ref.errorfunc.phpThere are options to enable error logging, you can log to a file or to the system log. Link to comment Share on other sites More sharing options...
kurt.santo Posted December 20, 2007 Author Share Posted December 20, 2007 Cheers! Will also have a read on weekend...Kurt Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.