Magento is a powerful eCommerce solution that runs on a Linux environment. If you are a small business owner or a technical person that wants to try out Magento locally without investing in a whole new operating system, there is a way you can install it on your local machine.
In order to install it on a local Windows system, you will need to first download XAMPP. From here you will be able to manage the services for the Apache application server as well as the MySQL database. For Magento 2.3.0, it is very important that you download the specific versions mentioned here as you will run into a lot of trouble when it comes to version mismatches.
Step 1: Install XAMPP
Download XAMPP for Windows version 7.2.14
Once the download is complete, execute the file from the Windows environment that you want to install Magento. You may see the following warning message:
Just click OK to continue. |
This installation wizard will open. I recommend doing a straight install that includes all of the selected components.
Click Next > |
Make sure the file location for the installation is C:\xampp. Continue with the installation Wizard until it is complete. Before closing out of the wizard, make sure the box is checked to open upon finalization.
You will see the XAMPP Control Panel v3.2.2.
The modules that we are interested in here will be Apache and MySQL. If you select Start under Actions for the Apache module, you may receive an error message in the window below.
- #Listen xx.xx.xx.xx:80
- Listen 80
- ServerName localhost:80 (a bit further down)
Click Save and Save. |
- Apache will be your Application Server
- The root is going to be C:\xampp\htdocs
- PHPMyAdmin will be your database tools
Step 2: Install Magento
- xsl
- intl
- soap
Save the document and close. Restart the Apache and MySQL services.
Step 3: Create a Database
Name the database Magento and select Collation from the dropdown menu. Click Create. |
Now in the left pane, you will see your new database listed.
Step 4: Finally, time to Setup Magento
If you get this screen, you are doing great! Click Agree and Setup Magento to continue. |
- Step 1 of the Magento Setup is a readiness test. You may receive an error such as:
Once you see this screen, click the Next button at the top of the page to continue. |
- Step 2 of the Magento setup is to add the database to Magneto.
We did not set up a password for the database so you can leave it blank. Database name will be whatever you named it in Step 3. Leave the first two as is. |
- Step 3 of the Magento setup is the Web Configuration.
- Step 4 of the Magento setup is the Customize Your Store.
Setup your store defaults. Click Next. |
- Step 5 of the Magento Setup is to Create an Admin account for Magento.
Fill in the information for the Admin account. Click Next. |
- Step 6 of the Magento Setup is to Install Magento.
Click Install Now and have a lot of patience. There will be times when it seems like it isn’t doing anything at all. If you are not sure, you can open the console log below the progress bar and see if it is actually performing any actions. Just be patient.
The first time I ran this, it errored out at 52%. Checking the console log I saw that the error was on Module “magento_Catalog’: Not really knowing what to do, I performed the following:
Uninstalled XAMPP, opted for it to delete the folder once it was installed. Of course, it didn’t so I went to the folder in File Explorer and deleted it. Then, I started the whole thing over again making sure to use a fresh download of the Magento file.
- Magento is successfully installed!
Step 5: The Moment of Truth
Login with the credentials created in Step 5 of the Magento Setup. |
Step 6: Tying up loose ends.
Modifying the Validator.php File
$realPath = $this->fileDriver->getRealPath($path);
Comment it out with // in front of it like this:
// $realPath = $this->fileDriver->getRealPath($path);
Below this line, add the following:
$realPath = str_replace('\\', '/', $this->fileDriver->getRealPath($path)); //EH0219
Best Practice: I have placed //EH0219 to document that Elizabeth Huber added this line in Feb. 2019.
We are telling the system to use a single forward slash instead of a double backslash. This is because Windows does not use double backslashes.
Once that is done, save and close the document. You are welcome to restart your services and try again but you may receive an error message. This is because we need to reindex our Magento modules.
Reindexing Magento Modules
Go back to your XAMPP Control Panel. On the right-hand side, there’s a button with a cmd prompt icon that says Shell.
You will notice that it opens a cmd environment in folder C:\xampp. We need to be in C:\xampp\htdocs\magento. To do this, we will enter the following:
# cd C:\xampp\htdocs\Magento <press enter>
Now that we are in the correct folder, we will type in the following:
# php bin/magento indexer:reindex <press enter>
Once that is done, you may close the Shell. You are welcome to restart your services and try again but you may receive yet another error message.
You may need to make one more modification.
Go to File Explorer and navigate to:
C:\xampp\htdocs\Magento\app\etc
Open di.xml with a code editor and search for:
Comment this line out (by placing // in front of the line), copy the full string:
<item name=“view_preprocessed” xsi:type=“object”>Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
Paste this just below this line and change Symlink to Copy:
<item name=“view_preprocessed” xsi:type=“object”>Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
![]() |
Will look like this. |
Save and close the document, restart your services and try accessing the website, and admin panel once again. If you are still getting an error, go back into this file and remove the // on the Symlink line, and place it on the new line that you changed to “Copy”. I don’t know why, but that worked for me.
If you know a way to streamline these steps, please let us know in the comment section. This is just how I was able to get it up and running for myself. I hope that it works for you too.
I honestly don’t know very much about Linux or PHP. I have usually only worked with Microsoft proprietary applications. My specialty with Magento up until this point has been supporting the integration of Magento to Microsoft Dynamics NAV. In a later post, we will discuss the integration with Microsoft Dynamics NAV and Business Central using the TINX-IT connector.
I’ve been struggling for hours with versioning (xampp and php) and came across this post. Awesome! Thank you so much for putting it out there!
muchas gracias, salio todo bien
It worked very very well. Thanks so much!
The URL mentoned in Step 3: Create a Database is wrong!
The correct one is https://localhost:7777/phpmyadmin/
An excellent guide. Really good and recommend for beginners.
Hi thanks for the excellent guide. It almost worked for me. For me it wasn’t to replace $realPath but to copy the line and paste it in the foreach below.
Thanks so much i’ve been stuck since yesterday on this issue.Really saved my day.God bless you.
After installing I get a 404 error object not found on both the admin and front end URLs.
P.S I installed everything correctly
As mentioned, I don’t really know much about Linux or PHP; I actually support Dynamics NAV/Business Central and Magento’s connection to it. My ability to support your issues may be limited, but I will certainly do my best to help if I can.
Are you using the urls listed on your success page for “Your Store Address” and “Magento Admin Address”? These are comprised of the port change in Step 1, database setup, and web configuration. Verify the spelling. It may even be case-sensitive; I’m not sure. If you continue to have issues, try pushing through Step 6. Please let us know if you continue to have issues.
Great link it really helped out. Very detailed explanation
I few minor notes/hints for anyone that might use this page:
1. This setup needs to be run with the exact xampp and magento versions. Otherwise, it won’t work. To find the exact xampp version you need to click on more downloads and navigate to the exact XAMPP version.
404 Error, or some deprecation issues occur if you don’t follow the versions exactly.
2. There are minor discrepancies in the instructions about the naming of the folder in htdocs. Consider “Magento” and “magento” as the same. I chose the lowercase name and did not have any problems
3. Commenting in di.xml should not be with “\\” it should be with , so I was confused about Step 6. What worked for me is, I left Symlink and I added the others
Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
4. Copy -> Paste from step 6 on these values copies with the wrong quotes – ”, instead of “. So just do find-replace.
All in all very helpful instructions. I just made the mistake with the versions and was dumbfounded why it was not working 😀
Thank you! It really helped me a lot, I was strugling for like three days.