Most Common Magento 2 Problems and Solutions

Friday, 23 September 2022 03:18

Most Common Magento 2 Problems and How to Fix Them

Whatever operation developers or administrators perform on the Magento shop is not simple. And although though running into Magento 2 issues is something no one ever wants to do, they can happen while upgrading Magento, installing Magento 2 extensions, making numerous requests for products, running scripts or files without the proper execute rights, etc. These Magento problems can be simple to rather complicated, impacting your website's functionality and user experience. They are, however, typically manageable if you recognize their timing of appearance. Let’s explore the most common issues with Magento 2 and their fixes.

Most Common Magento 2 Problems and Solutions

1. Access Denied

The Magento admin area is where the Magento Access Denied HTTP error 403 most frequently arises. It happens when you attempt to visit a page that you are not authorized to see due to incorrect login information, an incorrect user role, or the installation of Magento 2 extensions.

How to fix Magento 2 ‘Access Denied’ Error

a) Get correct credentials

The only way to recover your admin panel login credentials is by using the database tables. Run the next SQL query in your database by going there:

SET @salt = MD5(UNIX_TIMESTAMP());
UPDATE admin_user SET password = CONCAT(SHA2(CONCAT(@salt, 'YourNewPassword'), 256), ':', @salt, ':1') WHERE username = 'admin';

Now attempt to log in using the new password. If you are unable to do so, check the first failure and lock expires columns in the admin user table and set their values to null.

b) Assign proper user role

After adding a new user to Magento, if you get the "Access forbidden" problem, it’s likely because you haven’t given them a user role.

In this situation, either log in using a different account or request that the administrator go to System > Permissions > All Users and add your user to a specific user role.

How to Fix the "Access denied" error in Magento 2

c) Get permissions to access a particular extension

You might not have access to see new extension settings because Magento doesn’t automatically update rights to new extensions. Re-logging into the admin interface frequently helps. Reset admin permissions if the Magento “Access denied” problem still appears.

  • Locate the role for which the new extension is restricted by going to System > Permissions > User Roles.
  • In the Role Resources section, change Resource Access to All or a specific extension.

How to Fix the "Access denied" error in Magento 2

d) Fix the system.xml and config.xml conflict

The “Access forbidden” bug in Magento 2 might occasionally emerge after activating some custom modules and prohibit you from accessing the custom module.

Try turning off the extension to see if the problem persists. If so, look at the config.xml and system.xml files. There may be blank spaces in the config.xml and system.xml files.

2. Internal Server Error 500

The standard 500 HTTP status code error that shows when the server is unable to provide the requested page is the Magento internal server error. Reloading the page could work, but more often than not, you’ll need to look through the server logs to learn more about the problem.

How to fix Magento 2 Internal Server Error 500

Enable developer mode and remove the comment from the following line before continuing. You can quickly debug Magento and receive the specific errors in the error log, in the app/bootstrap.php file.

#ini_set('display_errors', 1);

a) Change File Permissions

When you attempt to access the Magento admin panel or the connect manager when the Magento permission files are incorrectly set, the Magento internal server error most frequently manifests.

After Magento installation, the index files’ default permission is 664 while it should be 644. Run the following instructions in the index.php file located in the Magento root to modify the default file permissions from 664 to 644.

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

b) Increase Memory Limit

For the Magento platform to operate properly, specific system capabilities are needed. This does apply to some PHP memory restrictions. The default memory limit supplied by Magento hosting providers is often 20MB or 60MB, which is insufficient for Magento.

The php memory limit setting in the php.ini or .htaccess files has to be increased to 756M in order to resolve the Magento internal server error 500.

  • Use SSH to connect to your website server.
  • Locate the php.ini file’s folder and use the vi editor to access it.
  • Add the next line to it.
    memory_limit = 756M
  • If the value is too low, raise it.

c) Rename .htaccess File

Setting up the .htaccess file correctly is crucial since any mistakes or typos might result in problems, such as the Magento 2 500 internal server error. When you install plugins, patches, or themes, problems in the .hraccess file arise and call for appropriate adjustments.

d) Disable Third-party Extensions

To determine whether the problem will be resolved, try deleting or renaming the .htaccess file.
After you install or upgrade any third-party Magento extensions, Internal Server Error may happen. The new extension or version and the already installed modules on your shop are typically at odds with one another.

To remove the extension, use the next command:

php bin/magento mod:disable VenorName_ModuleName

Once you’ve ran it, reach the seller to know more and request the remedy.

e) Disable Maintenance Mode

When maintenance mode is enabled, the root folder of Magento receives the maintenance.flag file. As a result, web browsers cannot run the modified index.php file, which now has permission 666.

To remove the upkeep, enter the following command.

Set the permission for the file to 755 and flag it.

php bin/magento maintenance:disable

=> View full list of Common Magento 2 Errors and Solutions

 

cmsgadget Stats

We're serving 1074 free
and 3943 premium themes

Providers

All 3.0 Joomla wordpress Wordpress prestashop PrestaShop magento Magento oscommerce osCommerce drupal Drupal