Magento error 500: Reasons for error and how fix them fast in Magento 2

Magento error 500 is a common error that can appear in almost all Magento 2 websites, so don’t be too hard to solve them. You just need to find the reasons of that error and do one of the below solutions. This post will provide you some solution to solve this error in your Magento 2 store. Let’s get started right away!

What is Magento error 500?

magento-error-500

Magento error 500 is one of the common errors you will encounter when working with Magento 2. It is error in the hosting environment which usually happen while installing, upgrading, or removing Magento components like themes, plugins, patches, etc. Moreover, you will face this problem while installing Magento or upgrading Magento or system backup, on the product page or admin login page.

Causes for the occurrence of Magento 2 500 Internal Server Error

There are five main causes why you encounter the internal server errors on Magento 2 website:

  1. Permission Issues
  2. Memory Limitation
  3. Issues with .htaccess file
  4. Third-party plugin issue
  5. Missing Extensions

1. Permission issues

One of the most common reasons leading to Magento error 500 is the misconfigured permissions of the Magento 2 files. Magento 2 users usually encounter this problem while accessing the Magento admin panel or the Magento connect manager. The reason is that  the default permission of the index files after Magento 2 installation will be 664. Some systems won’t accept these permissions and then this error appear.

2. Memory limitation

The PHP memory limitation is another common cause that may  lead to a Magento internal server error 500 after you upgrade the data. Magento 2 is a resource-wasting application and this error can appear when the server or the user’s account does not provide enough resources to run Magento 2.

For instance, insufficient memory or low execution time set for the account can often create problems. Normally, most of the web hosts set the default memory limit as 20MB, 33MB, 65MB, etc. However, it’s not similar in Magento 2 websites. So, a sensible memory allocation is 256MB. while, the default timeout value may be 40sec, 60sec, 90sec, etc. Sometimes, the Magento application takes more time to return the output and end up with this Magento error 500 .

3. Issues in the .htaccess file

Issues in the .htaccess file typically happen when you try to install some components such as themes, plugins, patches, etc. in Magento. Wrong configurations in .htaccess file can block the installation of new components. For example, syntax errors, URL rewrite errors, or typo mistakes, in .htaccess can lead to problems

4. Third-party plugin issue

Moreover, you can encounter the Magento error 500 after implementing a new extension or updates. In this case, you can use command php bin/magento mod:disable to turn off the mod and contact your vendor as soon as possible.

5. Missing modules

Sometimes you can get the Magento error 500 during Magento installation due to your server doesn’t support some of the specifications. In this case, you can use the Magento Check to find out what plugin are missing and then install them on the server.

How to fix Magento 2 500 internal server error

fix-magento-error-500

Before solving this problem, you must need to enable developer mode. Developer Mode permits you to get more insights into the exception error.

Enable Developer Mode in Magento 2. To do this, you use the below syntax

php bin/magento deploy:mode:set developer

Let’s start with the some methods to solve Magento error 500.

Method 1: Change Magento File Permissions

Magento error 500 is common error when logging into the admin panel. It can be resolved  by changing the file permission of the index.php file from root 664 to 644.

You can use the below command one by one after the check problems may be solved

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
find ./var -type d -exec chmod 777 {} \;
find ./pub/media -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
chmod u+x bin/magento

Method 2: Increase Memory Limit

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

For the .htaccess file, run the below lines of code:

php_value memory_limit 1024M

For the php.ini file, run the below lines of code:

memory_limit = 1024M

However, if you do not get hosting permission you can’t change it by yourself. For that, you need to contact your hosting suppliers to make the adjustments.

Method 3: Rename or Remove .htaccess file

In some case, the error may happen due to the mistaken settings in the .htaccess file. Try renaming or removing the .htaccess file to check if the error is resolved. If it doesn’t show 500 errors after removing the .htaccess file, then there must be some PHP version problems or any server configuration is missing.

Method 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 use the below syntax:

php bin/magento maintenance:disable

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

Method 5: Install CURL Extension

Sometimes missing CURL extension may lead to Magento 500 internal error. You can install CURL extension by use the below syntax via ssh (Centos):

yum install curl libcurl3 libcurl3-dev php5-curl

service httpd restart

Then, check again if the error is resolved.

Conclusion

That’s all about Magento error 500 that we want to deliver to you. We hope that you can fully understand what is Magento error 500 and how to fix them fast. In case you have other troubles with your Magento online store or you are looking out for a cost effective Magento package for your eCommerce store, then come to Magesolution. We not only offer an affordable Magento Development Package for all size and budget but also ensure that it helps your online business grow and sustain. Contact us for a free consultation!