Search
×
Log in or create an account
If you have an account with us, please log in.

You have no items in your shopping cart.

Frequently Asked Questions

How can we help you?

banner image

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.

Permissions error

Misconfigured permissions are one of the most common reasons for the Magento server error 500. To fix this problem, 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 (https://example.com/magento/magento-cleanup.php) 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
</IfModule>

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. 

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 (https://example.com/magento/magento-check.php) 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.

Rate the answer?

Total rating: 5.0

If you didn’t find the answer on your question, please, ask here:

Back to top