How to fix Magento 500 Internal Server Errors in Magento and Magento 2


When working with Magento, sometimes you will see the error Magento 500 Internal Server Errors when updating/installing or removing Magento or Magento 2 components, such as: Themes, plugins, patches… or 500 internal server error after system backup, on product page, on admin login, after performing Magento upgrade, or after install Magento. The error looks like this:

Magento 500 Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

In this tutorial, I will list all the possible causes and solutions to fix this error.

Enable Developer mode

Developer mode allows you to debug Magento to see detail exceptions on error page instead of showing a generic error message like “There has been an error processing your requestMagento exception printing is disabled by default for security reasons“. or 500 Internal Server Errors

Enable developer mode in Magento 1

Open your site’s index.php file and uncomment these lines

Save the file file and now your index.php file will look as below

enable developer mode magento 1

Now clear cache and reload your error page to see detail of the error.

Enable developer mode in Magento 2

Open your ssh client and enter the following command

Another way is that you can Set the web-server variable MAGE_MODE  to the value developer . For example, in Apache, add the following code to your .htaccess file:

for Nginx users, changing htaccess file won’t work, you need to add set $MAGE_MODE developer;  to nginx.conf file as below:

A not-recommended option is that you can also enable developer mode via index.php file of Magento 2 by adding this line to index.php:

Now the error is displayed, we need some solution to fix this error.

Solution 1: Changing Magento file permission

We usually see Magento 500 Internal Server Errors when logging to admin panel, to solve this go to file manager of your Magento website and change permission of index.php file in root from 664 to 644

change file permission for index file magento

You should also change permission of another index.php file located in downloader/index.php to 644, otherwise you will see 500 internal server error when navigating to System > Magento Connect >Magento Connect Manager.

Solution 2: Increase php_value memory_limit 

When you see the error in a specific page of your Magento site like checkout page, product page, this may be because your server are lacking of resource to run Magento. For a store with ~500 products, it’s recommended to have at least 256M for php_memory_limit value. You can this value via .htaccess file or php.ini file

For .htaccess file

Add the following lines

For php.ini file

Add/change the following line

If you can’t change your self due to lack of permission on hosting, ask your hosting provider, or you can pick a hosting from this list of best optimized Magento hosting to avoid lack of resource.

Solution 3: rename/remove .htaccess file

Sometimes the error is simply caused by wrong settings in .htaccess file, for example: wrong url rewrite/redirect setting. You can try renaming/removing .htaccess file to check if the error is gone

remove htaccess file magento error

You can read this article to learn how to optimize .htacess file for better Magento load speed

Solution 4: Disable Magento maintenance mode

Maintenance mode in Magento can be enabled by put maintenance.flag file in Magento root folder (learn more). The maintenance mode also changes file permission of index.php to 666, which makes it unable to executed by web browers.

Disable maintenance mode in Magento 1

Go to root folder of Magento and remove Maintenance.flag file.

remove maintenance file magento

Disable maintenance mode in Magento 2

Remove var/.maintenance.flag file or run this command from your ssh

Next, change permission for index.php to 755 and clear cache to see if the error is fixed

Solution 5: install CURL extension for your server

Sometimes missing CURL extension may cause Magento 500 internal error. You can install CURL extension by running the following command via ssh (Centos)


Next, restart httpd to apply changes

Still see the error?

Drop a line here to describe your issue and we will see if we are able to help you

How to fix Magento 500 Internal Server Errors in Magento and Magento 2
4.11 (82.2%) 109 votes


About Author

Daniel is a Magento developer with 5 years of experience with customizing Magento extensions, Magento templates. He's main author at Magento explorer


    • Hello, please clear cache and check your .htaccess file. Normally, you will see the error Internal Server error due to .htaccess file not working on new domain.

  1. It’s show internal error when i install magento at wampserver .
    [Sun Mar 11 20:01:08.725591 2018] [core:alert] [pid 3296:tid 908] [client ::1:62597] C:/wamp64/www/magento/.htaccess: Invalid command ‘<IfVersion', perhaps misspelled or defined by a module not included in the server configuration

    How to fix it

Leave A Reply