Skip to main content

How To Install Magento-2.4 on Windows & LocalHost

Magento is the most popular open-source e-commerce CMS which is written in PHP language and used by merchants to sell their products and grow their online stores.

Initially it looks like the installation of magento is a very tough process and for it some expertise is required but by following the below steps you can install magento in your local environment within a few hours. 

We can divide magento installation in below 3 steps:

Implement Required Settings Before Installing Magento:  Below steps you need to follow before installing the magento:
  • Server Setup: Before installing the magento you need to set up your server. For the local environment you can install XAMPP, WAMP etc.
  • Configure php.ini: Enable the below php extensions which are required to install the magento. bcmath, ctype, curl, dom, gd, hash, iconv, intl, mbstring, openssl, pdo_mysql, simplexml, soap, xsl, zip, ext-sockets  
To enable these extensions go to the php.ini file and remove the semicolon(;) before the extension and restart the server. 
  • Configure PHP Settings: In php.ini file, search and change the following values as below:
          max_execution_time=18000 
          max_input_time=1800 
          memory_limit=4G
  • Download Elasticsearch: For magento latest versions elasticsearch is required. So Download elasticsearch from “https://www.elastic.co/downloads/elasticsearch”. Unzip the downloaded archived file at the location “xampp\htdocs\”. Now right click on the  elasticsearch.bat file within the “xampp\htdocs\elasticsearch\bin” folder and select administrator.

Install Magento: To install magento follow the below steps:
  • Download Magento: Download the magento from the magento official site. You can download magento with sample data or without sample data. After downloading, create the folder named “magento” at “xampp/htdocs” location and extract all the magento downloaded files within this folder.
  • Create Database: Create a database in which all the magento tables will be stored on/after installing the magento.
  • Install Magento: To install the magento you have to run below cmd command:

Within this command you have to define all the credentials regarding database, magento admin login etc.
Errors During Magento Installation: You will face some issues during magento installation. Some of them are as below:
  • If you get the error like below:
Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterThemes for module Magento_Theme. Original exception message: Wrong file In Gd2.php line 72: Wrong file Gd2.php line 72: Wrong file Then Find the “validateURLScheme” function in “magentoRootFolder\vendor\magento\framework\Image\Adapter\Gd2.php” file(It may be at line 94) and Replace function with below function code:
  • Now if you go to your browser with this URL to access Magento 2 store: http://yourname.magento.com(In my machine, I have setup to http://localhost/magento) and  you see a blank page then follow the below:
Then Go to “magentoRootFolder\vendor\magento\framework\View\Element\Template\File\Validator.php” and find the line “$realPath = $this->fileDriver->getRealPath($path);” and replace it with “$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path));”
    Implement Required Settings After Installing Magento: You have to implement some settings after installing magento also. Follow the below steps for it:
    • Copy the “index.php” and “.htaccess” files from the pub folder and paste into the root directory. Both files are in the pub folder when we download the setup for security purposes, but we’ve to follow this step while installing in the local.
    • Replace “require __DIR__ . '/../app/bootstrap.php';” with “require __DIR__ .'/app/bootstrap.php'; ” in the index.php file that we’d paste in the root directory.
    • In db “core_config_data” table insert following data:
    • If images are not showing in magento frontend: Run below command to resize all images: php bin/magento catalog:images:resize
    • Disable TwoFactor auth module to stop two factor authentication in magento admin: Disable this module by running below command: php bin/magento module:disable Magento_TwoFactorAuth 
    • If magento admin login doesn’t work on localhost follow the below steps:
              Add extension=sodium to php.ini 
               Copy php/libsodium.dll to apache/bin/ 
                 Restart Server

        Comments

        Popular posts from this blog

        Supermax Opencart Point of Sale

        Supermax helps the merchant to do the retail transaction of their physical store in a single window. Store owners can easily place orders of their physical store to their opencart online store. As this extension is built on Google Angular Platform so it’s a single page application and works smoothly without page loading in every request. Features Multi-Language and Multi-Currency with RTL Supported.  In-built Progressive web Application (PWA)  Works in offline mode and synced all the offline data automatically after online. Made On Google Angular Framework. Single Page Application. Responsive Design Work On Tablet / Mobile / Desktop / Laptop.  Fast Loading and Easy Search With Category And Product Name.  Quick Checkout With Payment Method Selection.  POS owners can select existing customers at the time of checkout.  Admin can set store details like name, address, email, Tax number, etc. to show in customer invoice.  Separate login panel for the POS terminal.  The

        Magento 2 Products

        Magento 2 is an open-source E-commerce platform and is the most used CMS (Content Management System) to create online stores. There are two versions of Magento 2: the Community version and the Enterprise version.  In the Magento 2 community and enterprise, there are six product kinds. Over the Community version, Magento 2 Enterprise provides a number of beneficial features. One of these extra features is Gift Card, the seventh product category, which is not included in the Community version. Each type of product with an example is explained below: 1. Simple Product Simple Product is the most popular product of a store. In Magento, it is also defined as its name, which means that this type of product is sold in every single item ( non-variation). Every single product has its own SKU (Store Keeping Unit) code. For example, a single bag that is only sold in a fixed size, weight, material, etc. 2. Configurable Product The configurable product includes many simple products. The collection o