Magento 2 is one of the most powerful eCommerce platforms, providing extremely high customizability and scalability. However, the complexity of the platform also leads to several critical errors that can disrupt operations. These errors can happen with respect to server configuration, backend setup, frontend design issues, and poor database connectivity. 

Through this blog, we have listed the most viable solutions to the most common Magento 2 errors to ensure smooth shopping experiences.

Error 1: Internal Server Error 500

The internal server error 500 is a common Magento issue that is caused when the server cannot access the request page.

Solution

Reloading the page may resolve the issue, but if that does not work, you should do the following: 

  • Modify file permissions.
  • Find and fix errors (if any) on the access file. Change the file name.
  • Open php.ini and increase the memory_limit value.
  • Disable the third-party Magento extensions.

Error 2: PHP Error (Memory Limit Exceeded)

Your website may malfunction due to PHP errors in Magento 2. To ensure a smooth performance, you must allocate 2GB of memory for PHP processes and debugging.

Solution

To resolve the exceeded memory limit issue, you should review the error logs and increase PHP memory_limit in php.ini. Here’s how you can do it:

  1. Log in to the Adobe Commerce server.
  2. Use the following command to find the php.ini file: bash $ php –ini
  1. Open the php.ini file specified under the Loaded Configuration File using a text editor.
  2. Locate the memory_limit option within the file.
  3. To support normal usage and debugging, set the value to 2GB.
  4. Close the text editor after saving your changes.
  5. Restart your web server.
  6. Retry the installation process or refresh the page.

Error 3: Error Processing your Request

Misconfigurations, runtime errors, or unhandled exceptions in the system can lead to this error.

Solution

Here are some ways you can fix the ‘error processing request’ issue:

  • Clear the Magento cache.
  • Read the log files manually located in /var/report.
  • Enable exception printing errors.

Error 4: Configuring Magento with a New Domain

If you want to switch your Magento store from www.olddomain.com to www.newdomain.com, here’s how you can do it:

Solution

  1. Open MySQL Manager and select Magento database.
  2. Open the core_config_data table.
  3. Locate the web/secure/base_url and web/unsecure/base_url entries.
  4. Replace the old domain name with the new one.
  5. Save the changes by clicking on the ‘Go’ button.

Error 5: Resetting the Admin Password

Forgetting admin password is a common occurrence. But resetting the admin password is really easy, and you don’t need to worry at all.

Solution

Here’s a quick and simple method of changing or resetting the password of the Magento admin panel.

  1. Visit phpMyAdmin or your MySQL Manager and select your Magento database.
  2. Navigate to the admin_user table.
  3. Create a new password and replace it with the old one. Make sure the new password is entered in MD5 format.

Error 6: Resetting File and Folder Permissions

File and folder permissions are one of the most common problems faced by developers during the installation and upgradation of the additional features in Magento. When you install Magento or any other external extensions, the default permissions are reset, which not only leads to functionality issues but also increases security risks.

Solution

Here’s how to fix this issue:

File Permissions Command

It’s important to set file permissions to 660 when working on Magento. With this permission configuration, only the owners and their group would be able to read and write while other users would be restricted. Here’s the command to execute the file permission:

find . -type f -exec chmod 644 {} \

Folder Permissions Command

All directories, in Magento, should have the permissions set to 770 to allow owners and their group to read, write, and execute permissions. You can use 755 if 770 isn’t applicable. Run the following command to execute the new permissions.

find . -type d -exec chmod 755 {} \

Resetting File Permissions

  1. Go to your Magento root directory:
  2. Execute these commands to reset permissions:

**cd **

find . -type f -exec chmod 644 {} \;  # 644 permission for files

find . -type d -exec chmod 755 {} \;  # 755 permission for folders

chmod 644 ./app/etc/*.xml

chown -R :<web server group>

chmod u+x bin/magento

Note: These permissions are also critical for resolving Magento migration issues.

Error 7: Set Backend Session Timeout

The default session time limit set by Magento 2 is 215000 seconds, which can interrupt the operations (especially during any activity).

Solution

The time limit can be easily modified. The following steps can help you change and increase the session time limit.

  • Log in to the Magento Admin Panel.
  • Go to Stores > Settings > Configuration > Advanced.
  • Select Admin > Security.
  • Set the Max Session Size in Admin (in seconds).
  • Save the configuration.

For the Magento 2.1+ users, follow the below steps to change the admin session lifetime (in seconds):

  • Log in to the Magento Admin Panel.
  • Go to Stores > Settings > Configuration > Advanced.
  • Select Admin > Security.
  • Set the Admin Session Lifetime (in seconds).
  • Save the changes.

Error 8: Cache Issues

While the cache is an excellent way to improve website loading time and user experience by delivering content faster through the stored browser data, the cached data may sometimes lead to conflicts or even prevent fresh UI changes from appearing. The website’s performance and functionality can be severely affected by this.

Solution

Clearing the cache should be the first thing to do before making any UI changes. Here’s how you can clear the cache from the Magento Admin Panel:

  • Log in to the Magento Admin.
  • Go to System > Tools > Cache Management.
  • Choose the Cache Type you wish to activate.
  • Choose Refresh and click Submit in the Actions dropdown. (Additionally, you can scroll down and flush the additional cache).
  • Clear Static Files Cache.

Alternatively, executing the commands below from SSH can also clear the cache:

  1. sudo php bin / magento cache: flush
  2. sudo php bin / magento cache: clean
  3. sudo php bin / magento c:f
  4. sudo php bin / magento c:c

The cache folder is located in your Magento root directory /var/cache. If you can access SSH, delete the folder to clear the cache.

You can find the cache folder in the Magento root directory /car/cache. In case you can access the SSH, clear the cache by deleting the folder. 

Error 9: Magento 2 Indexing Issue

Store owners often encounter performance issues with product restocking, updating existing products’ price lists, or saving configuration changes in Magento. However, frequent caching and index rebuilding can also contribute to a slowed-down website, affecting its overall performance.

Solution

To fix this problem, Magento’s indexing should be set to “Update on Schedule.”

There are two indexing modes offered by Magento:

  • Update on Save: Setting indexing to “Update on Save” triggers the specific index every time a product, attribute, or category is saved. While it comes in handy for instant updates, it consumes significantly more resources, slowing down your server.
  • Update on Schedule: Setting the indexing mode to “Update on Schedule” ensures that the cron job executes all your tasks at the scheduled time. So, it offers you the benefit of running tasks during off-peak hours.

You can check the indexing mode by executing the following command:

  • php bin/magento indexer:show-mode

Run Indexer Command

Run the following command to change the indexing mode to “Update on Schedule”:

  • php bin/magento indexer:set-mode schedule

And here’s the command to set the indexer’s mode to “Update on Save”:

  • php bin/magento indexer:set-mode realtime

Use Magento Admin to Run Indexing

You can also use Magento admin to run indexing. Here’s how you can do it:

  • Log in to the Magento Admin Panel
  • Go to System > Index Management
  • Select all indexers and click on “Update on Schedule” from the Actions dropdown.

Configure Cron Group Indexer

You can automate the indexing process by using cron jobs for scheduling.

  • Log in to the Magento Admin Panel
  • Go to Store > Settings > Configuration
  • Navigate to Advanced > System > Cron (Scheduled Tasks)
  • Expand the Cron configuration options for the group: index section and adjust the configuration as needed.

Error 10. 404 error for scripts and CSS

When Magento 2 tries to create symlinks for static resources (when not in production mode), this issue appears leading to broken scripts and CSS.

Solution

This behavior can be resolved by following the steps below:

  • Open app/etc/di.xml
  • Locate the virtualType name=”developerMaterialization”.
  • Here, find an item with the name, “view_preprocessed” and change the content as provided below:
    • Previous: Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
    • Modified: Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
  • You can also delete the item entirely.
  • Go to pub/static and delete the files under the directory to flush any existing symlinks. But do not delete the .htaccess file!

Error 11: Magento 2 frontend is not working after updating

Because of outdated static content or cached files, the Magento 2 frontend may stop functioning properly after an update.

Solution

To fix the issue, you need to regenerate the static content. Here’s how to do it:

  • Switch to developer mode by using the command:

php bin/magento deploy:mode:set developer

  • Then navigate to Magento 2 installation directory using Command Prompt or Terminal.
  • Run the following command to deploy the static content:

php bin/magento setup:static-content:deploy

  • Navigate to var directory and execute the command below:

rm -rf var/cache/*

rm -rf var/composer_home/*

rm -rf var/generation/*

rm -rf var/page_cache/*

rm -rf var/view_preprocessed/*

  • Reindex the data by running:

php bin/magento indexer:reindex.

Error 12: The following modules are outdated

When switching git branches in the dev environment or updating Magento 2 or any Magento extension, many Magento 2 developers come across a common error:

The following modules are outdated: Vendor_Module schema: current version – x.x.x, required version – z.z.z 

Solution

While this error is a common occurrence, it can be fixed in a few simple steps:

  • Update the extension code: Update the extension code to the latest version. To do so, execute this CLI command in the root directory of Magento:

composer install

If you face issues with this command, jump to the next step.

  • Upgrade your database: Execute the following CLI command to upgrade the database:

php bin/magento setup:upgrade

  • Manually update database entries: In case none of the above steps help, then run the following SQL query by going to your database:

UPDATE `table_prfix_setup_module` 

 SET schema_version=”z.z.z”, data_version=”z.z.z”

 WHERE module=”Vendor_Module”;

Don’t forget to replace “table_prfix_” (located in app/etc/env.php) with the prefix used in your database. In case you have not used any prefix, keep it empty.

Error 13: bin/magento Fatal error: Allowed memory size of xxx bytes exhausted

While running the Magento 2 CLI command, “bin/magento…”, developers may encounter an error that reads:

Allowed memory size of xxxx bytes exhausted (tried to allocate xxx bytes)

It’s generally caused by the PHP memory limit configuration.

Solution

This error can be easily fixed using the following command:

php -dmemory_limit=-1 bin/magento ….

Since the error is connected to the PHP memory limit configuration, the -dmemory_limit=-1 parameter allows you to bypass any limitations to run PHP in the CLI.

Examples:

php -dmemory_limit=-1 bin/magento setup:upgrade

php -dmemory_limit=-1 bin/magento setup:di:compile

Use php.ini file to modify the memory limit configurations (as described above in the blog).

Error 14: Magento PWA Studio build or deployment issues

Magento PWA Studio setup and deployment errors can occur because of a number of reasons. From wrong NPM or Node.js versions to incorrect Magento GraphQL configuration and missing dependencies, you have to find the reason behind the issue to fix them.

Solution

Here are the fixes to the most common reasons behind Magento PWA Studio Build or Deployment Issues.

  • Check Dependencies:
    • Make sure that the installed versions of NPM or Node.js are compatible. You can switch between node.js versions using tools like Node Version Manager (nvm).
    • Confirm the correct NPM and Node.js versions by opening the package.json file and checking the engines section.
  • Install Missing Dependencies:
    • Execute the command below in the PWA project directory, which will install all packages that are necessary.

npm install

  • If the issues are still not resolved, retry again after clearing the NPM cache. Here’s the command:

npm cache clean –force

npm install

  • GraphQL Configuration:
    • Run the following command to make sure that the GraphQL is enabled in Magento 2:

php bin/magento module:enable Magento_GraphQl

php bin/magento setup:upgrade

  • Check GraphQL queries and confirm that they are returning the expected data by leveraging GraphiQL or similar tools.
  • Build Errors:
    • If you’re getting errors while building the project, you need to rebuild the PWA Studio project by running the following command:

npm run build

  • Execute the command below to make sure that the project is prepared for deployment.

npm run stage

  • Additional Considerations:
    • Check the configuration settings of Magento 2 to review the security, caching, and performance.
    • To maintain accuracy, review the PWA Studio configuration files, such as webpack.config.js, env.js, etc.
    • Identify the issues in both Magento 2 and PWA Studio by monitoring the error logs.

Conclusion

While Magento 2 is one of the most sophisticated solutions for eCommerce development, it doesn’t come without hurdles. But these fixes for the most common Magento 2 errors will help you overcome the odds and leverage the Magento goodness minus the hassle. 

For errors other than the above, you can refer to the Magento communities and forums, where thousands of Magento experts and users can help you with your concerns.

Author

Jackie writes about industry trends, tips & tricks, and everything in between to help retailers start and grow their awesome business.

Write A Comment