Jump to content

Server error messages


kurt.santo
 Share

Recommended Posts

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

http://www.w3.org/Protocols/HTTP/HTRESP.html
Unauthorized 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

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

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

.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

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
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.

Link to comment
Share on other sites

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

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
Right. 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

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

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?Kurt
I'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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...