SiteCozy

  • My account

Reasons for getting a 500 internal server error message

2019-02-20

Most of the time the 500 “internal server error” message is due to a malfunction from the server. However, you will see below that there are several causes that explain this server response.

Bad command in a Htaccess file

A 500 error occurs when a bad command has been added to an HTaccess file of an Apache server. Most of the time, there are several cascading htaccess config files on an Apache server installation. This is important to check every htaccess file to understand from where the culprit command comes from.

A PHP script error

Sometimes a PHP script triggers the 500 internal error message. After modifying a PHP file, the error vanishes and the server responds to the request. The webmaster will not be able to get additional information about the PHP error. Maybe, it would be useful to look into the PHP log files on the server to find the root cause of the issue. A PHP 500 error page isn’t a bad thing. It prevents the code to be displayed in browsers and being read by hackers who are willing to steal passwords and blackmail webmasters.

500 error programmatically generated

A programmer has the ability to return a 500 error depending on some criteria. In this case, it is not an error. This is expected behavior from the server code the programmer. For example, the programmer wants to prevent bots to visit a page. So, the server code has been designed to return a 500 error message to bots and a 200 OK message to regular visitors using browsers.

HTTP fields aren’t valid

Some servers may bug when they receive HTTP fields from the requesters that aren’t valid to him. There are may too many HTTP fields or the contents of those HTTP fields may not suit the server.

A case study

a 500 internal server error from the Sitecozy broken link checker

In the example above, the server returned a 500 internal server error message. However, the page is accessible from a browser without any issue. We replicated the error by using the unix command curl (available on macOs from terminal and can be installed on Ms Windows). Here is the result below:

$ curl -I http://www.maconnerie33bordeaux.fr/a/villenave-d-ornon-33
HTTP/1.1 500 Internal Server Error
Date: Wed, 20 Feb 2019 12:51:30 GMT
Server: Apache
X-Powered-By: PHP/5.3.3
P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"
Cache-Control: no-cache
Pragma: no-cache
Set-Cookie: c80bfa3dcc51838606150c76c2755d87=c6cf5ec39f60dcad587d2b9a382e301d; path=/
Connection: close
Content-Type: text/html; charset=utf-8

We found that the server returned a 500 error only when we requested the HTTP headers without the HTML content. As you can see the server features a script that returns a 500 error, if a client requests the HTTP headers of a page.  By removing the parameter -I, it works because it returns the content of the page.

Related Posts:

  • Main reasons for 520,521,522 cloudflare errors
  • Reasons for getting a "403 forbidden" error message
  • How to create redirects for a WordPress site without Htaccess/nginx
Download our Broken link checker freeware here Buy a license key for the Sitecozy broken link checker

Customer Login

Lost password?

Categories

  • Webmaster advice
  • SEO advice
  • Web hosting
  • SiteCozy link checker KB
  • WordPress theme & plugin reviews
  • All articles
Disclosure: We are a professional review site that receives compensation from the companies whose products we review. We test each product thoroughly and give high marks to only the very best. We are independently owned and the opinions expressed here are our own.

Copyright Sitecozy 2018