Menu Close

Install Magento 2.4.1 on Windows 10/11 using Composer and Command line Localhost XAMPP server

Ok, let start…

1. Download Install XAMPP and Composer

2. Enable Extesion : intl , soap ,socket ,xls 

3. Install Elasticsearch 7 & run and test

https://www.elastic.co/downloads/elasticsearch

put it in C:\xampp\htdocs\elasticsearch

click elasticsearch.bat file to run it

C:\xampp\htdocs\elasticsearch\bin\elasticsearch.bat

Once it is properly run then you will be able result on following localhost link

http://localhost:9200/

do not turn off elasticsearch

4. Download Magento 2.4 from magento official site

On windows devices we need following changes in Gd2.php and di.xml files

-> Find validateURLScheme function in vendor\magento\framework\Image\Adapter\Gd2.php file. at line 86. Replace function with this:

private function validateURLScheme(string $filename) : bool
  {
      $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;
  }

-> Change Symlink to copy in file di.xml

Find file Validator.php in …Magento\Framework\View\Element\Template\File

At around line 138 replace code with this one

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

5. Now, Install magento v2.4.1 using Command line

php bin/magento setup:install --base-url="http://localhost/mage2.4" --db-host="localhost" --db-name="db_mage2.4" --db-user="root" --db-password="" --admin-firstname="admin" --admin-lastname="admin" --admin-email="user@example.com" --admin-user="admin" --admin-password="admin123" --use-rewrites="1" --backend-frontname="admin"

once it is complete then we need to run following command at beginning to populate data properly

5. Test and see the result

php bin/magento indexer:reindex

php bin/magento setup:upgrade

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

php bin/magento cache:clean

php bin/magento cache:flush

You can disable TwoFactorAuth module in localhost using following command

php bin/magento module:disable Magento_TwoFactorAuth

and it is done, please check link below and give your feedback or if you found any issue drop us email at hi@emadtech.com

http://localhost/mage2.4/

Leave a Reply

Your email address will not be published.