{"id":24590,"date":"2025-12-15T13:00:00","date_gmt":"2025-12-15T07:30:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/?p=24590"},"modified":"2025-12-15T12:32:53","modified_gmt":"2025-12-15T07:02:53","slug":"install-magento-2-on-windows","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/install-magento-2-on-windows\/","title":{"rendered":"How to Install Magento 2 on Windows 10 &amp; 11 (Using XAMPP)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Installing Magento 2 on Windows is an ideal way for local development and creating a safe environment for testing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This blog shows you how to install Magento 2 on Windows 10\/11 using XAMPP.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps for Installing Magento 2 on Windows&nbsp;<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you start installing, here is a table with all the needed software for Magento 2 installation on Windows.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Requirements<\/strong><\/td><td><strong>Description<\/strong><\/td><\/tr><tr><td>XAMPP on Windows<\/td><td>Provides the core server stack. Download a version from Apache Friends that includes PHP 8.1, 8.2, or 8.3.<\/td><\/tr><tr><td>PHP Configuration<\/td><td>Several PHP extensions (intl, soap, xsl, sockets, zip, gd) must be enabled by editing the php.ini file in the XAMPP control panel.<\/td><\/tr><tr><td>Database<\/td><td>A blank database (e.g., magento2) must be created. You can do this using phpMyAdmin, which comes with XAMPP (http:\/\/localhost\/phpmyadmin).<\/td><\/tr><tr><td>Composer on Windows<\/td><td>The PHP package manager used to download Magento. You must download the Composer-Setup.exe installer from getcomposer.org.<\/td><\/tr><tr><td>Elasticsearch \/ OpenSearch<\/td><td>This is mandatory. Magento 2.4+ will not install without it. You must download and run Elasticsearch (e.g., version 7.17.x) or OpenSearch separately.<\/td><\/tr><tr><td>Magento Auth Keys<\/td><td>Free authentication keys from the Magento Marketplace are required by Composer to download the Magento files.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Install XAMPP<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to the <a href=\"https:\/\/www.apachefriends.org\/index.html\" target=\"_blank\" rel=\"noopener\">Apache Friends<\/a> > download the XAMPP installer for Windows. Make sure the version includes <strong>PHP 8.1, 8.2, or 8.3<\/strong>.<\/li>\n\n\n\n<li>Run the installer and follow the setup prompts.<\/li>\n\n\n\n<li>Install XAMPP to the default location (C:\\xampp).<\/li>\n\n\n\n<li>Once installed, open the XAMPP Control Panel.<\/li>\n\n\n\n<li>Start the Apache and MySQL services.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Install Composer<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to the<a href=\"http:\/\/getcomposer.org\" target=\"_blank\" rel=\"noopener\"> getcomposer.org<\/a> page > download the Windows Installer (Composer-Setup.exe).<\/li>\n\n\n\n<li>Run the installer.<\/li>\n\n\n\n<li>Complete the setup and add it to the correct path is: <strong>C:\\xampp\\php\\php.exe<\/strong>.<\/li>\n\n\n\n<li>Complete the rest of the installation steps.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Install &amp; Run Elasticsearch (Mandatory)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2.4+ will not install without a search engine.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <a href=\"https:\/\/www.elastic.co\/downloads\/elasticsearch\" target=\"_blank\" rel=\"noopener\">Elasticsearch<\/a> &amp; Download the Windows ZIP file for the latest 7.x version.<\/li>\n\n\n\n<li>Unzip the folder to a simple location, like C:\\elasticsearch.<\/li>\n\n\n\n<li>Go into the bin folder (C:\\elasticsearch\\bin) and double-click the <strong>elasticsearch.bat<\/strong> file.<\/li>\n\n\n\n<li>A new command window will open and run the server. You must leave this window open the entire time you are working on your Magento store.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Configure PHP&nbsp;<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open <strong>XAMPP Control Panel<\/strong> and select <strong>PHP(php.ini)<\/strong>.<\/li>\n\n\n\n<li>Remove the semicolon (;) from the beginning of each one to enable them:\n<ul class=\"wp-block-list\">\n<li>extension=intl<\/li>\n\n\n\n<li>extension=soap<\/li>\n\n\n\n<li>extension=xsl<\/li>\n\n\n\n<li>extension=sockets<\/li>\n\n\n\n<li>extension=zip<\/li>\n\n\n\n<li>extension=gd<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Save and close the php.ini file.<\/li>\n\n\n\n<li>Stop and then Start the Apache service for the changes to take effect.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Create Your Database<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open your browser and go to <strong>http:\/\/localhost\/phpmyadmin\/<\/strong>.<\/li>\n\n\n\n<li>Click on the <strong>&#8220;Databases.&#8221;<\/strong> Under &#8220;Create database,&#8221; enter a name and click &#8220;Create&#8221;.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Download Magento 2 (via Composer)<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open the <strong>XAMPP Control Panel<\/strong> and click the <strong>&#8220;Shell&#8221;<\/strong> button. This opens a command prompt in the correct location.<\/li>\n\n\n\n<li>Navigate to your htdocs folder, which is the root directory for all web projects. Type: cd htdocs<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Run the Composer create-project command to <a href=\"https:\/\/meetanshi.com\/blog\/download-magento\/\">download Magento<\/a>. (This may take 10-15 minutes).<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">composer create-project --repository=[https:\/\/repo.magento.com\/](https:\/\/repo.magento.com\/) magento\/project-community-edition=2.4.7-8 magento2<\/pre>\n\n\n\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Go to the<a href=\"https:\/\/marketplace.magento.com\/\" target=\"_blank\" rel=\"noopener\"> Magento Marketplace<\/a>, log in (or create an account), go to &#8220;My Profile&#8221; > &#8220;Access Keys,&#8221; and generate a new key pair. Use the Public Key as your username and the Private Key as your password.<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Run the Magento Install Command<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After Composer finishes, all the files will be in C:\\xampp\\htdocs\\magento2. In the same XAMPP Shell, navigate into your new project folder: cd magento2<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now, run the single setup:install command to tell Magento how to set up your store.<br>Copy this full command, paste it into your shell, and press Enter:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">\nphp bin\/magento setup:install --base-url=\"[http:\/\/127.0.0.1\/magento2\/](http:\/\/127.0.0.1\/magento2\/)\" --db-host=\"localhost\" --db-name=\"magento2\" --db-user=\"root\" --db-password=\"\" --admin-firstname=\"admin\" --admin-lastname=\"admin\" --admin-email=\"admin@example.com\" --admin-user=\"admin\" --admin-password=\"AdminPassword123\" --language=\"en_US\" --currency=\"USD\" --timezone=\"America\/New_York\" --use-rewrites=\"1\" --backend-frontname=\"admin\" --search-engine=\"elasticsearch7\" --elasticsearch-host=\"localhost\" --elasticsearch-port=\"9200\"<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Post-Install Fixes &amp; Troubleshooting<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Admin Panel gives a 404 &#8220;Not Found&#8221; Error<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Symptom:<\/strong> The storefront at http:\/\/127.0.0.1\/magento2\/ works, but the admin panel at http:\/\/127.0.0.1\/magento2\/admin gives you a 404 error page.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cause:<\/strong> This is the most common issue with XAMPP. It happens because Apache&#8217;s URL &#8220;rewrites&#8221; (the mod_rewrite module) are not configured to work with Magento&#8217;s directory structure out of the box.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The Solution (The &#8220;Pub&#8221; Directory Fix):<\/strong> This is the exact solution you had in your original article. It&#8217;s a well-known workaround for XAMPP.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to your C:\\xampp\\htdocs\\magento2\\pub\\ folder.<\/li>\n\n\n\n<li>Copy the index.php and .htaccess files.<\/li>\n\n\n\n<li>Paste them into your root folder: C:\\xampp\\htdocs\\magento2\\ (and overwrite if asked).<\/li>\n\n\n\n<li>Open the new index.php file (the one in the root folder) in a text editor.<\/li>\n\n\n\n<li>Find this line: require __DIR__ . &#8216;\/..\/app\/bootstrap.php&#8217;;<\/li>\n\n\n\n<li>Change it by removing the ..\/: require __DIR__ . &#8216;\/app\/bootstrap.php&#8217;;<\/li>\n\n\n\n<li>Save the file.<\/li>\n\n\n\n<li><\/li>\n\n\n\n<li>Go to <strong>phpMyAdmin<\/strong> , select your magento2 database, and click the <strong>SQL<\/strong> tab. Run this SQL query to update the database paths:<\/li>\n<\/ul>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">SQL\nINSERT INTO core_config_data (path, value)\u00a0\nVALUES\u00a0\n('web\/secure\/base_static_url', 'http:\/\/127.0.0.1\/magento2\/pub\/static\/'),\n('web\/unsecure\/base_static_url', 'http:\/\/127.0.0.1\/magento2\/pub\/static\/'),\n('web\/secure\/base_media_url', 'http:\/\/127.0.0.1\/magento2\/pub\/media\/'),\n('web\/unsecure\/base_media_url', 'http:\/\/127.0.0.1\/magento2\/pub\/media\/')\nON DUPLICATE KEY UPDATE value = VALUES(value);<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, run a cache flush from your command line: php bin\/magento cache:flush<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Admin Panel is a Blank White Page<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Symptom:<\/strong> You go to the admin URL, and the browser loads a completely blank white screen. No error, no text.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cause:<\/strong> This is a specific, known bug when running Magento on Windows. A file validator in Magento&#8217;s code has an issue with the Windows-style file paths (which use a backslash \\ instead of a forward-slash \/).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The Solution (Edit Validator.php):<\/strong> <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Navigate to the file: C:\\xampp\\htdocs\\magento2\\vendor\\magento\\framework\\View\\Element\\Template\\File\\Validator.php<\/li>\n\n\n\n<li>Open this file in your text editor.<\/li>\n\n\n\n<li>Find the isPathInDirectories function (around line 114).<\/li>\n\n\n\n<li>Find this line of code inside the function: $realPath = $this->fileDriver->getRealPath($path);<\/li>\n\n\n\n<li>Replace that one line with this code, which adds a str_replace: $realPath = str_replace(&#8216;\\\\&#8217;, &#8216;\/&#8217;, $this->fileDriver->getRealPath($path));<\/li>\n\n\n\n<li>Save the file and refresh your admin page. It should now load.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>The Entire Site is Extremely Slow<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Symptom:<\/strong> Every single page load, on both the admin and the storefront, takes 10-30 seconds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cause:<\/strong> This is often a Windows networking issue where &#8220;localhost&#8221; is resolved very slowly. Using &#8220;127.0.0.1&#8221; (the direct IP address for your local machine) is almost always faster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The Solution (Change Base URL to 127.0.0.1):<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <strong>phpMyAdmin<\/strong> (http:\/\/localhost\/phpmyadmin\/) and open your magento2 database.<\/li>\n\n\n\n<li>Find the core_config_data table and click &#8220;Browse.&#8221;<\/li>\n\n\n\n<li>Find the rows for web\/unsecure\/base_url and web\/secure\/base_url.<\/li>\n\n\n\n<li>Change their value from http:\/\/localhost\/magento2\/ to http:\/\/127.0.0.1\/magento2\/.<\/li>\n\n\n\n<li>Run a cache flush from your command line: php bin\/magento cache:flush<\/li>\n\n\n\n<li>Now, access your site using http:\/\/127.0.0.1\/magento2\/ in your browser. You should feel a significant speed improvement.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Now, try this solution and install Magento 2 on Windows. If this process overwhelms you, our Magento 2 developer can manage this task for you with complete ease.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Installing Magento 2 on Windows is an ideal way for local development and creating a safe environment for testing. This blog shows you how to&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-24590","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/24590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=24590"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/24590\/revisions"}],"predecessor-version":[{"id":24969,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/24590\/revisions\/24969"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=24590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=24590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=24590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}