
This article will show how to install Magento 2 in windows with XAMPP in just seven steps, along with best practices and the right configurations. As our first step, letâs see the system requirements for Magento 2.
System Requirements For Magento 2:
- Apache 2.2 or 2.4
- XAMPP installed
- PHP version 7.0.13 to 7.2
- Mysql version 5.6 or 5.7
- Google chrome, firefox or Internet Explorer, etc.
Step 1: Installing XAMPP
- Go to the XAMPP installation page on the official website, click here.
- Download and install version 7.2 for windows.
- Save it in the disk and folder of your choice.
- Select all the necessary components that need to be installed along with xampp like Mysql, PHP, etc.
- Open Apache config and go to âphp.ini.â
- Remove the beginning semicolon â;â from âextension=php_intl.dll,â âextension=soap,â âextension=socketsâ and âextension=php_xsl.dll.â
- Run MySQL and Apache services from the apache control panel
Step 2: Installing Composer
- Install the composer from the official installation page of the composer; visit Download Composer.
- Browse the php.exe file in the xampp/PHP folder and install the composer
Step 3: Download Magento
- Download the Magento version 2.3.5 setup for windows and install
- Extract the installation archive and rename the extracted folder according to your liking.
- Now copy the extracted folder and paste that into your âxampp/htdocsâ location.
Step 4: Install Magento
- Start installing Magento by running localhost/Magento.
- Click start readiness check(it will check whether all system requirements are fulfilled or not and generate a report.
- After this, click ânextâ and start the âadd databaseâ step.
- Fill in the details, set âDatabase services hostâ to âlocalhost,â âDatabase Usernameâ to âroot,â and set the database name as you have created in âphpMyAdmin.â
- Next comes the web configuration, set âyour store addressâ to âhttp://localhost/magentoâ and âmagento admin addressâ by suffixing your admin username with the âstore address.â
- Now comes the âcustomize your storeâ phase here. Set the default timezone, default currency and language
- There are advanced configuration option too, which is optional, set it according to your need.
- Now create an account in the next step, using email id, password and username.
- Then comes the final step, click install now to start the installation.
Step 5: Remove Installation Error
- The installation wonât complete, and it will show an error, and you need to replace the function âvalidateURLSchemeâ in the filename â\vendor\magento\framework\Image\Adapter\Gd2.php.â
- You can replace this functionâŻvalidateURLScheme in File name: \vendor\magento\framework\Image\Adapter\Gd2.phpprivate 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) && strlen($url[âschemeâ]) > 1) {return false;}return true;
}
- Now refresh and click install again.
- When the installation completes, it will show a success message.
Step 6: Launching Admin Panel
- You can launch the admin panel in the browser
- If you still donât see the admin dashboard
- Change URL validator function in the file â/vendor/magento/framework/View/Element/Template/File/Validator.php:113 â
- Now when you refresh, you will see the login screen
- Fill the credentials and sign in
Step 7: Now, as the last step, we will remove errors in the browser console log and broken image links.
- Open the command prompt
- Go to the project location of Magento, e.g., âxampp/htdocs/magento.â
- Type the following command âphp bin/magento setup:upgradeâ
- After that type âphp bin/magento setup:static-content:deploy -f â
- And finally, âphp bin/magento c:c.â
Conclusion
Congrats, your Magento 2 store is ready to run on windows localhost. Hope you will find this article helpful; if you follow these steps properly, you will be able to run Magento 2 on windows localhost with xampp; if you cannot set it up, ask for the discussion forums, somebody will help you fix the issues.