How to fix Magento 2 500 internal server error

- Fire development, Magento 2

Magento 2 import export debug log

In the following article, we shed light on how to fix the 500 internal server error in Magento 2. The problem affects the overall e-commerce experience of a storefront, so it is necessary to fix it as fast as possible. Numerous users ask for help on various forums and community resources, and below, we explore the best resolutions!


H_Parekh describes the following situation on StackExchange. After uploading data to the server locally, the author changed the env.php file as well as the core_config_data table. Unfortunately, the running URL on the server gave the 500 server error. Although everything worked perfectly on the local one, the “500” issue prevented other interactions.

According to Suresh Chikani, you can run the following commands to start fixing the problem:

Next, it is necessary to give correct permissions to your directories. Bare Feet provides the following recommended settings:

Try to run these commands in SSH and your permissions should be sorted:

Matthew McLennan argues about the developer mode set via htaccess. The author gets the Magento 2 Internal Server Error 500 across site and admin URLs.

According to David Verholen, the files are automatically generated when requested and not found in developer mode. He recommends users to search for the webserver error log. On Apache, it is available in one of these 2 locations:

At the same time, Gaurav Patel recommends running the following command in the Magento root:

Zaheerabbas reports about 500 Internal Server Error when installing Magento 2.2.2. He proposes the following solution:

Firstly, you need to make sure that LoadModule version_module modules/ is loaded from httpd.conf file. This will help to resolve the invalid command ‘<IfVersion’, which is perhaps misspelled or defined by a module not included in the server configuration error.

Secondly, the author insists on setting the following variable values:

Thirdly, you can create a virtual host. Add the following code to your file path: D:\wamp64\bin\apache\apache2.4.18\conf\extra\httpd-vhosts.conf

Note that your path depends on your installation:

Next, you should make an entry in the host file following this example:


Now, let’s take a look at another example of the “500” error. Gluton faces the Magento 2 500 internal server error as well. The author can’t access the Magento directory due to the error. The directory is in chmod 775.

TiEul states that it is a permissions problem and recommends setting the correct permissions.

To fix Magento 500 internal server error, navigate to the Magento directory on your server:

Next, set the permissions via the following command:

If the aforementioned command doesn’t help, go to cd /var/www/magento/var/ and type ls -al. You will see if the permissions on all files are properly set. Note that your web server should be able to write/delete all files.

That’s it! Now, you know how to fix the 500 server error in Magento 2. For further useful tips, check our Cookbook.