Complete Guide to Fix Magento 2 500 Internal Server Error

In this article you going to see how to solve 500 internal server error in Magento 2 in detail and step by step by in a simple way.

If you facing this issue then you are at a right place to go through it.

Below are the main reasons because of which you can get internal server error.

Points are as follow as :

  • Issues due to Permissions.
  • Due to Memory limitation.
  • May be Issue in .htaccess file.
  • Module Missing
  • 3rd party Extension/Plugin issues

The main important part before doing anything regarding internal server issue.

It is very much important to enable developer mode.

To enable developer mode please execute the below command are as given below.

bin/magento deploy:mode:set developer

One more important is that developer mode not show all error.

So to get all the actual error please delete the comment from the line #ini_set('display_errors', 1).

Let’s start with topic of fixing the Magento 2 500 Internal Server Error.

Permissions Issues

Due to not given proper configuration of permission is one of major issue of getting internal server issue.

To fix this permission issue, you should execute the below command to update the folder permission of root folder.

cd <your Magento install dir>
find . -type f -exec chmod 644 {} \; // 644 permission for files
find . -type d -exec chmod 755 {} \; // 755 permission for directory
chown -R :<web server group> .
chmod u+x bin/magento

For more detail information regarding system permission, check with the Magento official link .

Due to limitation of Memory.

The cause of internal server error is also due to one of the major factor called PHP Memory limit.

To fix this you just need increase memory limit.

It is inside php.ini file you have add this.

If you have a server access, just open file and increase the memory limit.

memory_limit = 756M

756M is minimum value you can set to more.

Otherwise add the below code in htaccess file.

<IfModule mod_php5.c>
php_value memory_limit 756M
</IfModule>

Due to Issues in the .htaccess file

Mostly, problems regarding htaccess file get occurs during installation process of Magento, Theme, Patches and many more things.

At that time process, if you have not done the configuration properly, more chances of you getting internal server issue.

So to fix this just rename the htaccess file and check error logs in /var/log/httpd or /var/log/apache2 file path.

If you get any other issue, check and correct the configuration.

Module Missing

During Magento Installation, sometime you get internal server error it is because of server doesn’t support some of the point.

To fix this, you can use the Magento check [https://example.com/magento/magento-check.php] to find out what modules are missing and then install them to the server.

3rd party Extension/Plugin issues

This is also one of major reason of getting internal server issue in Magento 2 after implementing a new plugin or updating the module.

During this time you have to first disable the module by using following below command and if its major you can contact your vendor as soon as possible.

Magento 2.4 Installation

Conclusion:

Finally, we have done with the main reason behind getting of Magento 2 500 Internal Server Error.

I hope you like this article and if you feel like we missed out on anything, please comment below.

Leave a Comment