How to fix internal server error 500 in Magento 2?

You may experience internal server errors for one of the following reasons:

  • permissions issues
  • memory limitation
  • issues in the .htaccess file
  • missing modules
  • third-party plugin issues

You need to enable the developer mode before you do anything else. To do so, run the following command:

bin/magento deploy:mode:set developer.

For more information on Magento modes, you can check out the official Magento documentation here.

However, the error is not always displayed in developer mode. It can be shown by moving to the app/bootstrap.php and deleting the comment from line #ini_set('display_errors', 1).

Note: Enabling developer mode can make your live store insecure. It is possible for malefactors to take advantage of the problem.

When you enable developer mode, you will see a problem, let's look at how to fix all of these issues.

Get unmatched Magento 2 Optimization Service from Magespark, and our Certified Magento 2 developers will identify the issues and all major factors affecting your store performance, and solve all issues without any hassle.

Permissions error

Magento server errors 500 are most often caused by misconfigured permissions. To fix these problems, you can update your root folder permissions by using the following 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
  • find ./var -type d -exec chmod 777 {} \;
  • find ./pub/media -type d -exec chmod 777 {} \;
  • find ./pub/static -type d -exec chmod 777 {} \;
  • chown -R :<web server group>.
  • chmod u+x bin/magento

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

To learn more about system permissions, you must need to read the official documentation here.

Memory limitation

One of the most common reasons for getting the 500 error after data upgrade in Magento 2 is the PHP memory limit. The only thing you need to do in this situation is to increase the volume.

You just need to access the php.ini file on your server and add the following entries:

memory_limit = 756M

There is a minimum memory value of 756M, you can set more memory volume.

Or, you can add the follow code to your .htaccess file:

<IfModule mod_php5.c>
php_value memory_limit 756M

Issues in the .htaccess file

Generally, when you try to install a theme, plugin, patch, or other components, you can often encounter such issues with the .htaccess file. The other cause to get the 500 error with your Magento website is when you have made some configuration errors.

If that is the case, rename the file temporarily and check /var/log/httpd or /var/log/apache2 for error messages. Make sure that the configurations are correct in case you still face any other conflicts.

Modules not found

In a few cases, your server may not be able to support some requirements, resulting in an internal server 500 error. If this happens, you can use the Magento Check ( to identify which modules are missing on the server and then install them accordingly.

Third-party plugin issue

Furthermore, you can also encounter this error when you implement a new extension, plugins, or make updates in Magento. If this is the case, you can then use the following command:
php bin/magento mod:disable

By doing so, you will be able to turn off the mode and contact your vendor as soon as possible.

If you purchase any extensions from a premier extensions Magento development agency, there will be very less chances of getting such technical errors. Search for our top-rated Magento 2 extensions and themes tailored to your unique Magento store’s needs.

Categories: General Questions