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
Post a Comment