How to fix error 500 in Magento 2?

There are five main reasons why you can get internal server errors on Magento 2 website:

  1. permissions issues
  2. memory limitation
  3. issues in the .htaccess file
  4. missing modules
  5. third-party plugin issues

But before doing anything, you need to enable the developer mode. For this, run the following command: bin/magento deploy:mode:set developer.

To learn more about Magento modes and how to change them, check the official Magento documentation.

But the developer mode not always shows the error. To display it, move to the app/bootstrap.php and delete the comment from the line #ini_set('display_errors', 1).

Attention: Turning on the developer mode can be insecure for your live website. Malefactors can see the problem and take advantage of it.

As the developer mode is on and you can see the error, let’s see how to fix each of the following problems.

→ Use Magento Optimization Service, and our experts will examine your website, find what affects its performance, and solve these issues.

Permissions error

Misconfigured permissions are one of the most common reasons for the Magento server error 500. To fix this problem with Magento shows error, you need to update permissions settings in your root folder by using these commands:

cd <your Magento install dir>
find . -type f -exec chmod 644 {} \; // 644 permission for files
find . -type d -exec chmod 755 {} \; // 755 permission for directory
chown -R :<web server group> .
chmod u+x bin/magento

Or you can use Magento Cleanup utility ( to set correct permissions automatically.

For more information about system permissions, check the official documentation.

Memory limitation

The PHP memory limit is another popular reason to get the 500 error in Magento 2 after data upgrade. In this case, you need just increase the volume.

If you have access to edit server settings, go to the php.ini file and add:

memory_limit = 756M

756M is the minimum value you can set more memory volume.

Otherwise, add this code to the .htaccess file:

<IfModule mod_php5.c>
php_value memory_limit 756M

Issues in the .htaccess file

Usually, problems with the .htaccess file happen when you are trying to run the installation of some components, such as themes, plugins, patches, etc. If you have some configuration mistakes, you can get the 500 error on the Magento website.

In this case, you can temporarily rename this file and check error logs in /var/log/httpd or /var/log/apache2. If you find any other issues, correct the configurations, and the issue connected to that Magento 2 displays errors should be fixed.

Missing modules

Sometimes you can get the internal server error during Magento installation because your server doesn’t support some of the specifications. In this situation, you can use the Magento Check ( to find out what modules are missing and then install them on the server.

Third-party plugin issue

Also, you can get the internal server error in Magento after implementing a new plugin or updates. In this case, use the following command php bin/magento mod:disable to turn off the mod and contact your vendor as soon as possible.

Technical errors make little problem in case you buy extensions from a premier extensions' builder. To sell products on the Magento marketplace and being certified by the experts, you need to adjust your in-house code standards to Magento's and meet all the compatibility requirements.
Not long ago, we've launched a new series of extensions that cover specific business needs under the crisis conditions, check the Anti-Crisis Program out.

How can we help you?

Didn’t you find the answer to your question? We are always happy to help you out.