How To Fix Magento 2 500 Internal Server Error

In this post, I will guide you on How To Fix Magento 2 500 Internal Server Error. This error occurs when the server of the website you visit is faulty and cannot provide or display any information or content.

Magento 2 500 Internal Server Error

During the operation of an e-commerce store, a disruption can greatly affect your business. Problems need to be fixed immediately to limit the rudeness that it brings. 500 Internal Server Error is an error that makes it difficult for sellers, it can be due to many reasons affecting your store. Follow the post to be able to fix this error.

Steps To Fix Magento 2 500 Internal Server Error

1. Set permissions for Magento file

Go to Magento 2 install directory.

cd <magento-install-directory>

Run commands:

rm -rf var/page_cache var/cache var/composer_home var/generation var/di var/view_preprocessed
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex

Typing the following commands to set permissions:

find . -type f -exec chmod 644 {} \;    // 644 permission for files
find . -type d -exec chmod 755 {} \;    // 755 permission for directory
find ./var -type d -exec chmod 777 {} \;// 777 permission for var folder    
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
chown -R :<web server group> .
chmod u+x bin/magento

2. Increase memory limit

Change the following line in php.ini file:

memory_limit = 1024M

Add the following lines in your .htaccess file:

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

3. Check .htaccess entries file

The .htaccess file will appear at the Magento root directory, pub folder, and vendor folder.

It is possible that when you try to install components such as themes, patches, or plugins, the wrong .htaccess file is installed. We recommend that you rename the .htaccess file and contact support to check it again.

4. Disable Maintenance mode

Maintenance mode changes the index.php file permissions to 666 and this makes the web browser unexecutable.

To disable maintenance mode you can delete the maintenance.flag file or run the command:

php bin/magento maintenance:disable

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

This is the end of the post How To Fix Magento 2 500 Internal Server Error.

Follow us for the more helpful posts!

We hope this is a useful post for you.

You can read more useful posts like How To Set Up State Options In Magento 2.

Thank you for reading!

5 1 vote
Article Rating

Aaron LX

Aaron is a passionate writer, crazy about shopping, eCommerce and trends. Besides his outstanding research skills and a positive mind, Aaron eagerly shares his experience with the readers.

Leave a Reply or put your Question here

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x