Skip to main content

Magento 2.x Troubleshooting Guide

The developers make every effort to ensure their Magento extensions are stable, reliable, and well-tested. However, due to the highly-customizable nature of Magento they cannot anticipate every possible configuration and so incompatibilities may arise. This guide gives an overview of the most common issues are found on client’s sites and how to resolve them.
The purpose of this document is to help the magento2 users in solving the commonly faced issues while installation and usage of Magento 2.x Extensions.

The purpose of this document is to help the magento2 users in solving the commonly faced issues while installation and usage of Magento 2.x Extensions.

The most common methods of troubleshooting are as follows:

  • Refreshing the Cache.
  • Reindexing the Magento
  • Solving 404 error on System Configuration
  • Permission issues on new extension
  • Disable Maintenance Mode if your Extension is not installed successfully
  • Disable the newly installed Extension if your Magento store stops working or throws fatal error
  • View list of extensions and Disable/Enable installed extensions
  • Fixing Permission error after running php bin magento/bin setup:upgrade command
  • Setting Deploy mode: Developer to see exact errors
  • Solving error while deploying sample data
  • Fixing errors while static-content deploy

REFRESHING THE CACHE

After installing the extension on Magento, if the installed Extension is not visible or is not working properly then you can try Refreshing the Cache from Magento Admin. You can do it via ssh/terminal (CLI) or can do it from admin panel.

1. VIA SSH/TERMINAL CLI

Run this command into CLI:

php bin/magento cache:clean
If it doesn’t solves the problem, run:

php bin/magento cache:flush

2. VIA ADMIN PANEL

To refresh the cache from admin panel, follow these steps:

Log into Magento Store Admin Panel
Navigate to System ⇒ Cache Management. Now select all the cache types in the list, choosing the refresh option in the drop down menu , and finally clicking submit.

REINDEXING THE MAGENTO


You can also try Reindexing the Magento, if you are having problem with your newly Installed Extension. It can be done by running this command in CLI:

php bin/magento indexer:reindex
Make sure that all indexers are reindexed and the output of the command looks like:

Category Products index has been rebuilt successfully in <time>
Product Categories index has been rebuilt successfully in <time>
Product Price index has been rebuilt successfully in <time>
Product EAV index has been rebuilt successfully in <time>
Stock index has been rebuilt successfully in <time>
Catalog Rule Product index has been rebuilt successfully in <time>
Catalog Product Rule index has been rebuilt successfully in <time>
Catalog Search index has been rebuilt successfully in <time>
Source: Magento DevDocs

SOLVING 404 ERROR ON SYSTEM CONFIGURATION

After installing your Extension, if you got 404 error on “System -> Configuration”, then it may be the problem of Magento Session/Registry, you can solve this issue just by Logging Out of Magento admin and Logging In again.

PERMISSION ISSUES EXTENSION

Sometimes the installation will fail because Magento doesn’t have sufficient permissions to write to the necessary web server directories. There are multiple ways to fix this.

Easiest way but not secure: Just give the 777 permission to your Extension folders and try uploading again.
Linux Permissions: Your apache user:group in linux and the folder permissions of your magento should match. e.g if your cPanel/ftp username/ssh user is “mjoy”. You need to check which group this user belongs to. Suppose “mjoy” user belongs to group “company”. In this case add “www-data” or “apache” group to “company” group as well. This is a bit complex to solve and require good knowledge of linux permission system.


DISABLE MAINTENANCE MODE IF YOUR EXTENSION IS NOT INSTALLED SUCCESSFULLY

The solution of this problem is simple:

Access FTP into your remote website directory where your Magento files reside.

Find & delete the file named maintenance.flag.

Your site should now work normally.

DISABLE THE NEWLY INSTALLED EXTENSION IF YOUR MAGENTO STORE STOPS WORKING OR THROWS FATAL ERROR

If you are getting any fatal error and getting any exception after you have installed new extension. Just disable the new extension. You can do that by running a command from terminal:

sudo php bin/magento module:disable YourExtentionName
After doing this clear the cache and try to load your store again.

VIEW LIST OF EXTENSIONS AND DISABLE/ENABLE INSTALLED EXTENSIONS

Some time after installing extension our extension does not appear in our store so to solve this issue we have to check few things that is given below:
Check list of extension installed in your store you can do that by following command in your terminal

sudo php bin/magento module:status
You will get list of all extension check your extension is there or not if not then you have to type another command to enable you extension

sudo php bin/magento module:enable YourExtentionName
After doing this you will get to see your extension on your store.

FIXING PERMISSION ERROR AFTER RUNNING PHP BIN MAGENTO/BIN SETUP:UPGRADE COMMAND

Once you have run upgrade command then if you will not give permission then you will get error like below:

In order to resolve it you have to run few commands that will give proper permission commands are as :

sudo chmod -R 777 var/
sudo chmod -R 777 pub/
sudo chmod -R 777 app/
Your permission issue will be resolved.


SETTING DEPLOY MODE: DEVELOPER TO SEE EXACT ERRORS

Magento comes with 3 different modes out of the box (developer, default and production). In order to check exact error you have to switch to developer mode for that write following command

sudo php bin/magento deploy:mode:set developer
Now it will be set to developer mode and you can check the exact error.


SOLVING ERROR WHILE DEPLOYING SAMPLE DATA

Some time when we are deploying sample data we get error in that case we can resolve the issue by the following command

composer config repositories.0 composer https://repo.magento.com
Your issue will be resolved.


FIXING ERRORS WHILE STATIC-CONTENT DEPLOY

We get error like this checkInstallationFilePermissions when we do static-content-deploy.

How to debug:

Open setup/src/Magento/Setup/Model/FilePermissions.php

Goto line 143 in method checkRecursiveDirectories

Add the lines var_dump($subDirectory); var_dump($subDirectory->isWritable());

Re-run:

php bin/magento setup:upgrade
Now you’ll see what is really wrong, and you can fix it.

Comments

Popular posts from this blog

DataTable with PHP and MySQL

Data representation in form of tables and grid is one of the most import web component. Generally we need to perform sorting, pagination on it, which is very complex task to do. To solve this problem, many grid view framework are there. Well, among these frameworks, DataTable is most popular. Features like open source, light weighted, highly flexible and customizable, features like AutoFill, inline editor, sticky header, responsiveness, bootstrap support and foundation are the reasons behind its popularity. In basic initialization datatable provides pagination, sorting, instant searching by loading whole data records at once. It can be a performance issue fetching large amount of data from server side. It will be better if you integrate server side pagination, searching and sorting, so we can break large amount data in chunk, So performance will increase significantly. Let’s have a look about using and customizing it. We need to include plugin files (js & css) and fetch data f

Delete All Products at Once | Magento

Well, usually during development, you may need to add some test products (Sample Data) which needs to be removed before moving the site to production. If the volume is large, then it would be very difficult to delete it from the Product Grid. In this case, you may need some trick. Well, you can use the following method: 1. Log into MySQL server via CLI or phpMyAdmin 2. Run the following SQL Queries and it will do the job: SET FOREIGN_KEY_CHECKS = 0; TRUNCATE TABLE `cataloginventory_stock_item`; TRUNCATE TABLE `cataloginventory_stock_status`; TRUNCATE TABLE `cataloginventory_stock_status_idx`; TRUNCATE TABLE `cataloginventory_stock_status_tmp`; TRUNCATE TABLE `catalog_category_product`; TRUNCATE TABLE `catalog_category_product_index`; TRUNCATE TABLE `catalog_category_product_index_tmp`; TRUNCATE TABLE `catalog_compare_item`; TRUNCATE TABLE `catalog_product_bundle_option`; TRUNCATE TABLE `catalog_product_bundle_option_value`; TRUNCATE TABLE `catalog_product_bundle_price_index`; TR

Why PHP Is Best For Web Development

While working on any website of web application, the first question that comes in mind is which programming language is best. If you ask programmers, they might love or hate PHP as server side scripting language. Well the opinions may vary but there are several reasons which make PHP one of the best programming language for web development. Here are 5 best reasons to love PHP (Hypertext Preprocessor): Less Expensive It requires no licensing fee and it has less expensive hosting servers available. Its software are mostly free and open source which makes it less expensive. Faster Web apps which are developed on PHP are comparatively faster as it uses its own memory space to run. Database Flexibility Well, one of the best reasons to love PHP is its flexibility towards databases. It can connect to several databases the most commonly used is the MySQL.  MySQL can be used for free. Very Good Documentation PHP also has very good online documentation with a good framework of f