WebMasterCampus
WEB DEVELOPER Resources

Magento2 Installation 2026

Magento2 Installation 2026


Step-1: Installation & Setup

  • Install xampp
  • Upgrade Php to 8.3.x
  • Install composer
  • Install Elasticsearch 7.x

Install xampp:

  1. download xampp and install it.
  2. Open Control panel and click admin of Apache to confirm

Upgrade php to 8.3.x:

  1. Download php 8.3.x
  2. Rename c:\xampp\php to php_bk
  3. Copy download php 8.3.x to c:\xampp\ (rename it php)
  4. cmd run php -v to verify or check localhost/dashboard/phpinfo.php

Install Composer:

  1. Download and run composer-setup.exe to install composer
  2. verify using cmd ‘composer –version’ or ‘composer -V’

Install Elasticsearch 7.x:

  1. Download elasticsearch 7.x (click view past releases to find 7.x)
  2. Keep under c:\ and rename folder to ’elasticsearch’
  3. Move into elasticsearch\bin\
  4. cmd run ‘./elasticsearch’
  5. Visit URL localhost:9200 to verify its working

Step-2: Enable PHP Extensions

Locate php.ini file (available in c:\xampp\php folder) and enable the following extensions by removing semicolon from start of line.

  • extension=curl
  • extension=ftp
  • extension=fileinfo
  • extension=gd
  • extension=intl
  • extension=mbstring
  • extension=mysqli
  • extension=openssl
  • extension=pdo_mysql
  • extension=soap
  • extension=sockets
  • extension=sodium
  • extension=xsl
  • extension=zip

Also, update the following values to extend memory, execution and input time.

  • max_execution_time=18000
  • max_input_time=1800
  • memory_limit=4G

Step-3: Create Database

Open PHP myadmin and create db name it magento2_db

use root user (for local setup)


Step-4:

  • Download inside c:\xampp\htdocs\ (move to this directory first then run the following command)
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition magento2
  • visit repo.magento.com to get user name and password
    • repo.magento.com (sign-in using google account)
    • go to My profile under you user Name drop down
    • Under My Products click Access Keys
    • Click Create a New Access Key
    • Copy user name and password
    • Now complete the magento setup using composer

To view global settings use command.

composer config --global --list

To remove your user name and password use the following command.

composer config --global --unset http-basic.repo.magento.com

Step-5: Server Configuration

File Location: C:\xampp\apache\conf\extra

Make sure magento folder exist in the htdocs folder

File Name: httpd-vhosts.conf

<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs/magento/pub"
    ServerName local.magento.com
</VirtualHost>


<VirtualHost *:80>
    DocumentRoot "C:/xampp/htdocs"
    ServerName localhost    
</VirtualHost>

Step-6: update host file

File Location: C:\Windows\System32\drivers\etc\hosts (Open in notepad with admin rights)

127.0.0.1 local.magento.com


Step-7: Installation of Magento2

**Run the following command in magento2 folder using cmd (admin rights) **

php bin\magento setup:install --base-url=http://local.magento.com --db-host=localhost --db-name=magento2 --db-user=root --db-password= --admin-firstname=Admin --admin-lastname=User --admin-email=admin@rocking.com --admin-user=admin --admin-password=tariq123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --backend-frontname=admin_60jwh61 --search-engine=opensearch --opensearch-host=localhost --opensearch-port=9200

possible error:

Unable to apply data patch Magento\Theme\Setup\Patch\Data\RegisterTheme for module Magento_Theme. Original exception message: Wrong file

In Gd2.php line 70:


Step-8:

To resolve open following file.

File Location: C:\xampp\htdocs\magento\vendor\magento\framework\Image\Adapter\Gd2.php

Old Code:

if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes)) {
		return false;
	}

New Code:

if ($url && isset($url['scheme']) && !in_array($url['scheme'], $allowed_schemes) && !file_exists($filename)) {
	return false;
}

Step-9:

File Location: C:\xampp\htdocs\magento\vendor\magento\framework\View\Element\Template\File\Validator.php

Original Code:

/*if ($directory !== null && 0 === strpos($realPath, $directory)) { */

New Code:

if ($directory !== null && 0 === strpos($path, $directory)) {
	return true;
}

Step-10:

File Location: C:\xampp\htdocs\magento\app\etc

original Code:

<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>

Updated Code:

<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>

Step-11:

Now, rerun the magento installation using command line

php bin\magento setup:install --base-url=http://local.magento.com --db-host=localhost --db-name=magento2 --db-user=root --db-password= --admin-firstname=Admin --admin-lastname=User --admin-email=admin@rocking.com --admin-user=admin --admin-password=tariq123 --language=en_US --currency=USD --timezone=America/Chicago --use-rewrites=1 --backend-frontname=admin_60jwh61 --search-engine=opensearch --opensearch-host=localhost --opensearch-port=9200

Next, visit local.magento.com


Step-12: To Fix Images and admin panel login issue

Run following commands one by one.

Note: Make sure to run these command in admin mode (open cmd as administrator)

php bin/magento indexer:reindex

php bin/magento setup:upgrade

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

php bin/magento cache:flush 

php bin/magento module:disable Magento_TwoFactorAuth Magento_AdminAdobeImsTwoFactorAuth

php bin/magento sampledata:deploy && php bin/magento indexer:reindex && php bin/magento se:up && php bin/magento  se:s:d -f && php bin/magento c:f

php bin/magento catalog:image:resize

php bin/magento cache:clean && php bin/magento cache:flush
Created with love and passion.