Installing Magento 2 on WAMP/XAMPP Server in Windows

Anup Sinha
4 min readSep 8, 2022

--

If you are new to Magento/Adobe commerce like me, this would be a great start to install and run Magento on your local machine. I will explain here how to install it in Windows machine and run it with WAMP Server. I will also highlight the errors which you will get during installation and how to fix those.

First of all if you don’t have WAMP server in your machine, please download and install it from this link — https://www.wampserver.com/en/#wampserver-64-bits-php-5-6-25-php-7.

System Requirement to run Magento -

  1. PHP 7
  2. MySQL 5.6
  3. Apache

Now download the Magento 2 Open Source version from here and copy it inside www folder of WAMP Server — https://www.mageplaza.com/download-magento/ or https://www.magestore.com/blog/download-magento-2/

Now go to PHP MyAdmin section of your WAMP server and create database for Magento installation.

Now if you go to http://localhost/magento2/ you will get the below error -

After struggling a bit to find the solution for this error I found that Magento actually requires Apache mod_version module to run. So you can go your Apache module settings from WAMP and enable it as shown in the screenshot below.

Now if you go to — http://localhost/magento2/ it will show you the message that vendor directory is empty. So you have go to the magento docroot folder and run “composer install” to install the dependencies.

Once the dependency installation is completed, you can refresh the URL and you should see the below screen.

Now for installation, first add the bin path of magento into the system variable so that we can run different commands for installation. One important thing to note that web interface for the installation and setup has been removed from the version 2.3.7. So now we have to install it through command line. Run the following command to check if the magento bin path has been setup correctly in system variable — “magento list”. It should show you all the available commands.

Now run the below command for installation —

php bin/magento setup:install \
--base-url=http://localhost/magento2 \
--db-host=localhost \
--db-name=magento \
--db-user=root \
--db-password= \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin@admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1

At first, you will encounter the below error and instillation will fail.

The root cause for this error is a function named — validateURLScheme inside the file- “www\magento2\lib\internal\Magento\Framework\Image\Adapter\Gd2.php”. Please modify the function as mentioned in this post — https://github.com/magento/magento2/issues/28055. Now run that installation command again and you will see the success message as below.

In the log, we will get the admin URI. If you are getting a blank page, try this fix — https://magento.stackexchange.com/questions/252168/magento-2-wamp-admin-page-doesnt-load-display

Now if you access — http://localhost/magento2/admin_1wyjtc [Admin URI which I got at the end of installation log], you will see the admin login screen. Now I was getting another error, CSS and JS was not loading for me. I ran the below two commands from magento doc root folder in order to fix the broken pages —

$ php bin/magento setup:static-content:deploy -f$ php bin/magento cache:flush

Finally all the issues have been fixed and this is how the Magento 2 Admin section looks like in my local machine :-)

Please follow me if you liked my post and want to see more contents on Drupal and PHP.

--

--

Anup Sinha

A senior Drupal developer with 9 years of experience. Acquia Certified Drupal 9 Developer @Infosys, Ex-Cognizant