Rate this post

Magento will end support for Magento 1 by June 2020. That’s why many users are migrating their Magento 1 store to Magento 2 store. However, Magento 1 to Magento 2 migration can be a challenging project. During the migration process, you can come up against issues since this procedure is extremely unpredictable and related to several customizations. 

Magento has developed a Magento Data Migration Tool to assist you with transferring your data. It will help you recognize the differences in the database structure between Magento 1 and Magento 2 databases. Most of these differences are declared in map files. The Data Migration Tool uses map files to transform data into the Magento 2 store. When differences are not declared in map files, then the Data Migration Tool displays an error message and stops running.

Today, we will learn How to fix 500 internal server error in Magento 2?

When do you get 500 internal server error in Magento 2

You have a problem with you website use magento 2. This is “500 internal server error” problem. So, when do you get this error?

Today, we also show you some cases when you get this issue:

  • Update, install, or remove a component such as theme, patches, plugins,…  on Magento website
  • After migrating the site to another server
  • After uploading data to the server locally, change some files and some tables in database.

How to fix 500 internal server error in Magento 2

Enable Developer mode

To displaying your error exactly, you have to Enable Developer Mode before doing anything. This mode allows you to debug Magento, which means it allows you to see detail exceptions on your error page, not just messages like “There has been an error processing your request”, “Magento exception printing is disabled by default for security reasons”, or “Magento 500 Internal Server Error”.

Fist way, you can enable it from the CLI:

Another way, we can enable developer mode in the env.php file:

  • Go to app/etc/ and open env.php
  • And change current application mode by ‘MAGE_MODE’ => ‘default’ to ‘MAGE_MODE’ => ‘developer

Or if you use Apache, we can change developer mode in your .htaccess file:

Then, please flush the cache.

If you are using NginX as the web server, changing htaccess file won’t work, you need to add set $MAGE_MODE developer; to nginx.conf file as below:

Now you can see your error that something like that:

Now we have four ways to fix this 500 internal server error in Magento 2.

1, Set permissions for Magento file

Re-update folders/files permission at your end following steps below:

+ Open your terminal and go to your M2 web root folder.

+ Enter the following commands to set permissions:

2, Increase php_value memory_limit

Sometimes, you can get “500 internal server error” when you migrate or update your data. Even you can see this error at some specific pages of your Magento site like checkout page, product page… The reason can your server are lacking of resource to run Magento. The solution is Increase php_value memory_limit.

To increase PHP memory limit setting, you can do this value via .htaccess file or php.ini file. Magento itself tries to enforce a default 768M limit across-the-board.

Firstly, please open your php.ini file, add/change the following line:

Secondly, please open your .htaccess file, add the following lines:

3, Check .htaccess entries file

There are three .htaccess files in your source code. You can find them here:

When you try to install a component such as themes, plugins, patches… or migrate data in Magento, you can get wrong settings in .htaccess file. It can block the installation of new components. Some error in .htaccess can create problems such as: syntax errors, URL rewrite errors, typo errors, etc..

With this case, you need to call your support Engineers to check whether .htaccess file that create problems by temporary renaming that file.

3, Enable Maintenance mode

When you implement your new updates, maintenance mode enabled on Magento. Permission in index.php file is changed by Maintenance flag to 666 which makes it unable to execute by web browsers.

After that, Magento can not change permissions of  index.php file or remove the  maintenance.flag. You can see “500 error” in this case.

Solution this case, you can remove var/.maintenance.flag file or run this command from your ssh:

Next, change permission for  index.php to 755 and clear cache.

That’s our solution for fixing 500 internal server error in Magento 2. Hopefully all of you can perform.

Thanks for reading!

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

Source documents are not mapped in Magento 2 Migration

Leave a Reply

Your email address will not be published. Required fields are marked *