Fix These Common Issues With Magento 2.4.1 For A Customer-Friendly Website In 2021

While working with Magento, developers may face many problems. However, those are easy to fix if you know the right solutions for them and have proper documentation. But sometimes, complex issues may require you to hire a Magento 2 developer for a quicker time to market your project. Today I am going to share the most common issues with Magento 2.4.1 and its solutions.

Common Magento 2 Issues

  • Installation issue
  • JS/CSS loading issue
  • Re-indexing
  • Speed up Magento 2 store
  • CSS cache
  • Admin session timeout & account sharing.

Composer Version

You can check the current composer version by running the command “composer -version.”

To update the composer version, you need to run the following command, and it will upgrade your composer to the latest version.

composer self-update

Installation Issue

You can increase the memory limit from the php.ini file by setting up the variable “memory_limit.”

You can find the loaded php configuration file by using the below command.

php -ini

Sometimes, after increasing the memory limit, we can not fix the issue, and we still face the same problem. We have another solution for the same. You will need to pass the memory limit parameter while executing the command like below.

php -d memory_limit=-1 composer.phar require [PACKAGE_NAME]

JS/CSS Loading Issue

You need to change in below file if the path is showing wrong for the Js/Css

open file /vendor/magento/framework/View/Element/Template/File/Validator.php and find

$realPath = $this->fileDriver->getRealPath($path);

replace with :

$realPath = str_replace(‘\’, ‘/’, $this->fileDriver->getRealPath($path));

If the file paths are correct and still js and CSS are not loading, then change in the below file.

open file app/etc/di.xml in Magento install dir, find
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

replace with :

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

After making changes in the above file, please deploy the static content. Run below command from Magento root directory.

php bin/magento setup:static-content:deploy

Re-Indexing

Setting up the cron jobs.

php bin/magento cron:run

Run indexer from the command line.

php bin/magento indexer:reindex

Speed Up Magento 2

Here Are A Few Easy Steps To Improve Magento’s Performance

System Requirement

Optimize Images

Enable Flat Catalog

Enable Varnish

Memcached

CSS Cache

rm -rf var/cache/* var/page_cache/* pub/static/*

php bin/magento setup:static-content:deploy

php bin/magento cache:flush

If you are using any third-party cache, you must refresh the third-party cache to reflect changes in the frontend.

Admin Session

While in development, Magento forces you to change your password after a limited period for security reasons. It is always a good practice to update passwords regularly. But you can disable this feature for the development environment. Follow the below steps to disable the feature.

Store > Configuration > Advance > Admin > Password Change

Final Words

Originally published at https://www.zealousweb.com.

We Fuel Notions that grow! We know Web, We know your industry and we’re here to help you.