Setup Magento On Localhost

Setup Magento On Localhost

Magento is an open-source e-commerce platform written in PHP. It uses multiple other PHP frameworks such as Laminas and Symfony. Magento source code is distributed under Open Software License v3.0. Magento was acquired by Adobe Inc in May 2018 for $1.68 billion. To Install Magento here are some simple steps that will help.

Following are the pre-requisites required for installing Magento. Download the setups of the following.

After downloading the setups, You need to install XAMPP and Composer and follow the steps below.

  • Start Apache and MySQL from XAMPP Control Panel.
  • Navigate to?htdocs?folder inside XAMPP installation directory.
  • Create a new folder inside htdocs with the name of “elasticsearch”. Paste the downloaded Elasticsearch zip file inside the newly created folder. Extract the zip file, navigate to?bin?folder, and double click on “elasticsearch.bat”?to start elasticsearch cluster.
  • Make sure that elasticsearch is up and running by visiting?localhost:9200?by any browser. You should see a JSON object.
  • Now visit?localhost/phpmyadmin?and create a new database ‘magento
  • Create a new folder inside?htdocs?with the name of ‘magento’. Paste the Magento zip file, that we downloaded earlier, inside this folder and extract it.
  • Inside your?magento?directory, navigate to?vendor\magento\framework\Image\Adapter?and open?G2d.php?with any code editor. Search for the method named “validateURLScheme”, which should be at?line # 86. Replace the entire method code with this code:


private function validateURLScheme(string $filename) : boo
{
   $allowed_schemes = ['ftp', 'ftps', 'http', 'https'];
   $url = parse_url($filename);
   if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) 
    {
       return false;
     }
   return true;
}        

  • Inside your?magento?directory, navigate to?vendor\magento\framework\View\Element\Template\File?and open?Validator.php?with any code editor. Scroll down to?line # 138. Replace the entire line with the following snippet:


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

  • Inside your?magento?directory, navigate to?vendor\magento\framework\Interception?and open?PluginListGenerator.php?with any code editor. Scroll down to?line # 158. Replace the entire line with the following snippet:


$cacheId = implode(‘-’, $this->scopePriorityScheme) . “-” . $this->cacheId;        

  • Inside your XAMPP installation directory, navigate to?xampp/php?and open?php.ini?with any code editor. Enable the extensions?intl, soap, sockets, xsl?on line 921, 943, 944, 949 respectively by removing semi-colon before the word extension. Now restart xampp.
  • Inside your magento directory, open cmd and run the following commands in order. If any command gives an error, make sure your PHP version is 7.3 or greater and you’ve made all the changes mentioned above.


php bin/magento setup:install --base-url=”https://localhost/magento" --db-host=”localhost” --db-name=”magento" --db-user=”root” --db-password=”” --admin-firstname=”admin” --admin-lastname=”admin” --admin-email=”[email protected]” --admin-user=”admin” --admin-password=”admin123" --use-rewrites=”1" --backend-frontname=”admin

php bin/magento setup:di:compile

php bin/magento indexer:reindex

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy –f

php bin/magento deploy:mode:set developer

php bin/magento cache:clean

php bin/magento cache:flush

php bin/magento module:disable Magento_Csp

php bin/magento module:disable Magento_TwoFactorAuth
        

  • We are nearly there. Open?localhost/phpmyadmin?and switch to database ‘magento’. Now the run the following query in the SQL Query tab:


INSERT INTO `core_config_data`(`path`, `value`) VALUES (‘dev/static/sign’, 0) ON DUPLICATE KEY UPDATE `value`=0        

  • Open?localhost/magento/admin?in any browser and login using ‘admin’ and ‘admin123’ as username and password respectively. After logging in, if the loader does not disappear and keeps on loading then there is one more change you need to make. Inside your magento directory, navigate to?app/etc/di.xml?and search for

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
        

and replace it with

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

  • Now refresh the page and voila, you have installed Magento 2.4 successfully! Phew, that was a lot of work.

要查看或添加评论,请登录

Syed Bilal Ali的更多文章

  • Building My First Shopify Custom App Using Remix

    Building My First Shopify Custom App Using Remix

    As a developer, we often encounter projects that challenge us, push our boundaries, and ultimately help us grow…

    4 条评论
  • A Comprehensive Guide on Integrating Firebase with Nest JS

    A Comprehensive Guide on Integrating Firebase with Nest JS

    Nest JS has become a popular backend framework. However, there is a lack of good articles or guides on how to integrate…

    4 条评论
  • Vite VS Webpack Mix

    Vite VS Webpack Mix

    Laravel Mix and Laravel Vite are the two options available to developers for front-end development in the framework…

  • Setting Up a LAMP Server on VPS Ubuntu (Apache2)

    Setting Up a LAMP Server on VPS Ubuntu (Apache2)

    In the realm of web development, mastering the setup of a LAMP (Linux, Apache, MySQL, PHP) server on Ubuntu is a…

  • Payment Process with Terminal Transaction

    Payment Process with Terminal Transaction

    Recently, I had the opportunity to dive deep into the world of Wallee Payment Gateway integration, and let me tell you,…

    3 条评论
  • Remove Image Background using NodeJS

    Remove Image Background using NodeJS

    Introduction: In today's digital world, images play a crucial role in various applications, from e-commerce websites to…

    2 条评论
  • NestJS unit testing

    NestJS unit testing

    This tutorial is a deep dive into unit testing in NestJS (including mocking with test doubles). To get the most out of…

    1 条评论
  • Pseudo-Palindromic Paths in a Binary Tree

    Pseudo-Palindromic Paths in a Binary Tree

    Given a binary tree where node values are digits from 1 to 9. A path in the binary tree is said to be…

  • JQuery ContextMenu plugin

    JQuery ContextMenu plugin

    Designed for web applications that require menus on a potentially huge number of items, the contextMenu Plugin In…

  • Building a Scalable Microservice Architecture for Nest.js Projects

    Building a Scalable Microservice Architecture for Nest.js Projects

    1. Introduction to Microservices 2.

社区洞察

其他会员也浏览了