500 Internal Server Error in OpenCart: How to Find The Cause

There are five different classes of HTTP status codes that identify the type of server response to an HTTP request:

  • 1xx: Informational

  • 2xx: Success

  • 3xx: Redirect

  • 4xx: Client Error

  • 5xx: Server Error

In this post, we will shed some light on the 500 Internal Server Error and give you a little hack to go beyond the standard browser message you get (which is not very useful).

What is 500 Internal Server Error?


The confusing thing about the 500 status code is that the server cannot process your request to access a page or website for an unknown reason.

At first sight, you have no idea what’s going on and even less idea where to find the issue, let alone how to fix it.

When Does the Error Occur?

The most frequent reason for getting a 500 Internal Server Error is a problem with the server configuration.

Maybe you have misconfigured your .htaccess file? Or maybe you have missing packages when trying to execute a PHP file while the PHP isn’t properly installed and running the incorrect version?

It’s very hard to have a precise answer for that since every case is different.

How to Understand the Cause?

There’s a very simple way for you to find out what’s causing the 500 Internal Server Error.

If you encounter an error in your OpenCart site, simply go to your store files and edit your index.php file.


Use your favorite text editor and at the top of your index.php file, paste these this code snippet after the opening <?php line:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);


Save the file and go back to the store.

Refresh the page where you encountered the error and you should get a report like this:

This is much better, right?

You can actually what caused the 500 Internal Server Error and the exact corrupted file.

This gives you a starting point for finding a solution to your error.

Frequent Cases & Possible Solutions

And like we said, the reasons for this type of error can be many:


Sometimes, the 500 Internal Server Error can be caused by incorrect permissions on your files or folders.

PHP Timeout

If your site’s script is connected to external resources that experience timeouts, your site can throw the HTTP 500 error. If this is the cause, think about some timeout rules or improved error handling on your end.

Error in .htaccess

Always be sure to check if your .htaccess file is properly structured and configured because it’s easy to make mistake that will cause the Error 500 if you don’t know how to work with your .htaccess correctly.

So, since the 500 Internal Server Error is a server-side error, you don’t need to worry that the problem is in your device or internet connection.

However, just to be sure that it’s not a deep issue, there are a few things you can do on your end.

Refresh the page

Sometimes the error might have been just a temporary issue. If that’s the case, simply refreshing the page a couple of times might get things going again.

ImportantIf a 500 Internal Server Error has appeared during checkout, mind that reloading the page might create two or more orders, hence two or more charges.

Clear your browser cache

Another thing that might cause HTTP 500 issues is if you’re viewing a cached version of the page and not the most recent one.

In this case, clearing the browser cache will alleviate the problem and you will be able to continue viewing the page normally.

Delete your browser cookies

A possible fix is to delete the cookies associated with the website. After you delete them, restart your browser and try accessing the website again.


The 500 Internal Server Error is a frustrating one, especially if you’re not very technically aware of your website’s setup. Use the code snippet we shared in the post to override your site’s error reporting so you can find out the main cause of the error and either look for a solution, or contact an OpenCart developer to give you a hand with it.

Join 11,000+ subscribers receiving actionable E-commerce advice

* Unsubscribe any time
comments powered by Disqus