500 internal server error only in Chrome and IE

by Tim Hill (aka Doodled)

November 28th 2012
This is the sort of page you will see on Chrome when it thinks there is a server 500 error
This is the sort of page you will see on Chrome when it thinks there is a server 500 error

What Chrome, Safari and Internet Explorer sometimes report as a 500 server error is actually misleading.

If you have a situation where Firefox works but Chrome shows a message like the one pictured to the right and IE simply says it cannot display the page (suggesting you might no even be online) then your issue may not be with your server.

I've put this post up because when you search for this issue so many people point you back to your host and server provider and in some cases that's a red herring.

There are two reasons I've uncovered so far as to why Chrome, Safari and IE might return a 500 error while Firefox seems to work happily enough:

  • Encoding - if your page is not encoded 'UTF-8 without BOM'.
  • Calling non-existant session variables - if your code (somewhere) looks for a session variable when no session has been started.

It's the second one that can drive you nuts. If you start from your home page and everything seems to work well but services like Google Webmaster Tools keep telling you they can't access or crawl your pages.

So you follow the broken link on GWT and it all seems to work (because you just went to your website earlier and started the session) but if you close the browser down and then open it again - to clear the session cookies - it all stops working!

Note this fix, in summary, is if:

  • Directly accessing a page works in Firefox but not in Chrome, IE or Safari
  • Your apache server error logs say nothing about a 500 error