Tuesday, June 25, 2019

Fixing 500 internal server error in Magento 2

Hello

Many times we are facing issues with 500 error code. There are many possible ways to come for it.  Here I display some solution for it. I hope it will help you to come out.

500 internal server error is a common one in hosting environment. It causes hiding actual PHP error then tells you contact admin system to report the real error. You can see this error when updating, installing, and removing components or after backup, etc.

This tutorial will show you solutions for fixing 500 error in Magento 2.
At first, you need to enable Developer mode, which allows you to debug Magento to see detail exceptions on error page instead of showing 500 internal server error.

First to enable Developer mode in Magento 2:

Open ssh client and add command:

Php bin/magento deploy:mode:set developer

Now you can see the error. Let’s start fixing it!


There are 4 ways for you to fix 500 internal server errors in Magento 2.

1: Change file permission
500 internal server errors appears when logging to admin panel, so to solve it, you need to change permission of index.php file in root from 664 to 644.

Additionally, another index.php file in downloader/index.php should be changed permission to 644 to avoid error when navigating to System> Magento Connect> Magento Connect Manager.

2 : Increase php_value memory_limit
If seeing 500 errors in specific pages like checkout page or product page, it means your server lacks of resource for running Magento. So you need to expand memory for your server.

For htaccess file:
Add lines below:
<IfModule mod_php5.c>
Php_value memory_limit 256M
</IfModule>

For ini file:
Add following line and change it:
memory_limit = 256M
3 : Rename/remove .htaccess file
Wrong settings in .htaccess file can cause error. In this case, you should try renaming/removing .htaccess file.

4 : Disable maintenance mode
The maintenance mode may cause changing file permission of index.php to 666 and make it appear error as web browsers is able to execute.

Do as follows to disable maintenance mode:

  • Remove var/.maintenance.flag file
  • Change php permission to 755
  • Clear cache


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

No comments:

Post a Comment