Hello Magento Friends,

Today I am here with a solution on How to fix Magento 2 500 internal server error.

Magento 2 500 Internal Server Error is the most common error in the hosting environment. Magento Internal Server Error 500 usually occurs while installing, upgrading, or removing Magento components like themes, plugins, patches, etc. The Magento 500 Internal Server Error is also likely to occur while installing Magento or upgrading Magento or system backup, on the product page or admin login page. 

With this error, the store faces a decline in traffic and impact the user experience. So it needs to be fixed quickly.

Reasons for the occurrence of Magento 2 500 Internal Server Error are:

  1. Permission Issues
  2. Memory Limitation
  3. Issues with .htaccess file
  4. Magento Maintenance Mode is Enabled
  5. Missing Extensions

How to fix Magento 2 500 internal server error:

Before fixing the issue, you must need to enable developer mode. Developer Mode allows you to get more insights into the exception error.

Enable Developer Mode in Magento 2:

To do this, run the below command

Let’s start with the ways to fix Magento 2 500 internal server error

Solution 1: Change Magento File Permissions

Magento 2 500 Internal Server Error is common when logging into the admin panel. It can be fixed by changing the file permission of the index.php file from root 664 to 644.

Run the below command one by one after the check issue may resolve.

Solution 2: Increase Memory Limit

Many times the specific page of Magento 2 store like checkout page or product page shows Magento 2 500 Internal Server Error. It can be fixed by increasing the memory limit vis .htaccess file or php.ini file.

For the .htaccess file, add the below lines of code

For the php.ini file, add the below lines of code

If you do not have hosting permission you can’t change it by yourself. For that, you need to contact your hosting provider to make the changes.

Solution 3: Rename or Remove .htaccess file

In some circumstances, the error may occur due to the wrong settings in the .htaccess file. Try renaming or removing the .htaccess file to check if the error is fixed. If it doesn’t give 500 internal server errors after removing the .htaccess file, then there must be some PHP version issue or any server configuration is missing.

Solution 4: Disable Maintenance Mode

Maintenance Mode can be enabled by putting the maintenance.flag file in the Magento root folder. The maintenance mode also changes the index.php file permission to 666 and this makes it unable for web browsers to execute.

Remove maintenance.flag file or run the below command

Then, change the permission of index.php to 755 and clear the cache to check if the error is fixed or not.

Solution 5: Install CURL Extension

Many times the Magento 2 500 Internal Server Error occurs due to missing CURL extension. Install CURL extension by running the below command.

To apply changes, restart httpd

Solution 6: Third-Party Plugin Issues

Also, you can get the internal server error in Magento after implementing a new plugin or updates. In this case, use the following command to turn off the mod and contact that module support team.

Solution 7: Check Web server Error Log

When facing a 500 error the first thing you should do is search for your webserver error log. Also, check the Magento log file in var/log.

Solution 8: Run Magento 2 all commands 

Run below commands:

Conclusion:

Magento 2 500 Internal Server Error is a common error, so no need to get afraid. You just need to find the appropriate cause and carry out the right solution. In case of any trouble, let me know via the comment section or you can Hire Dedicated Magento Developer that will help you fix the issues. Stay in touch with us for more Magento 2 solutions.

Happy Reading!

[Total: 2   Average: 5/5]