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. |
Click Next > |
This is because it is automatically set to use port 80. Port 80 is used by other Microsoft applications such as Skype. We will need to change this port to another port. I chose to use port 7777.
To make this change, click on the Config button on the Apache line. A dropdown will open with several options. Select the first one that says Apache (httpd.conf).
Within this config file, you want to basically find and replace 80 with 7777. It will be in three places:
- #Listen xx.xx.xx.xx:80
- Listen 80
- ServerName localhost:80 (a bit further down)
Once you have replaced 80 with 7777, save the document and close. Next, we will go back to XAMPP Control Panel and on the right-hand side, you will see another Config button at the top.
Click on that Config button and under Autostart of modules, check the box for Apache.
Then click the button for Service and Port Settings. Change the Main Port from 80 to 7777.
Click Save and Save. |
Now, restart the services for Apache and MySQL.
Voila! You now have a Linux server running on your Windows system. Next, we will install Magento.
A few things to note here:
- 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
Now we need to extract this file to our new root folder but first, we need to create a folder called Magento in C:\xampp\htdocs. You can create the Magento folder inside the htdocs folder from File Explorer first and then select it during extraction, or create the folder directly from the extraction by clicking on htdocs and selecting New Folder.
Next, we need to make some modifications to the php.ini file. We are going to enable a few extensions:
Go back to the XAMPP Control Panel and click the Config button on the Apache line. This time we are going to select PHP (php.ini) from the dropdown list.
To enable an extension, we will remove the semicolon in front of the extension we want to enable:
Do a find for the following 3 extensions and remove the semicolon (;) in front of each:
- xsl
- intl
- soap
Step 3: Create a Database
Now we are ready to create our database. Go to a browser and enter the following url:
Click the tab at the top for Database.
Name the database Magento and select Collation from the dropdown menu. Click Create. |
Step 4: Finally, time to Setup Magento
If you followed the above instructions exactly, you should have gotten to this point without any problems. Now, its the moment of truth. You may experience several issues from this point on, so be sure to pay close attention.
Go back to your web browser and enter the following url:
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:
This means you either skipped enabling the extensions in Step 2, didn’t save your file, or more extensions need to be enabled. Note the extensions marked with a red X and perform the actions in Step 2 to enable these extensions. Don’t forget to save the document and then restart the services. Then come back and click Try Again at the top of the page.
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.
- Magento is successfully installed!
You will receive a success message that says to “Please keep this information for your records”. Be sure to screenshot that information and save it somewhere for future use.
Step 5: The Moment of Truth
Now we go back to our browser and go to the following url:
You should be seeing a page that says LUMA at the top (Magento default theme). If you get a black screen, keep going with these instructions.
Also, go to the following url:
You should see a login screen for the Admin panel.
Login with the credentials created in Step 5 of the Magento Setup. |
If you see a broken image instead of the Magento logo, you will need to continue with the instructions. When you log in, you will notice that the logo is also missing at the top left-hand corner of the screen, and the “processing wheel of death” may just spin and spin. You aren’t done yet.
If you were able to access these without issue, Congratulations, you are done! You may explore all the greatness Magento has to offer to meet all of your eCommerce needs.
In step 6, we will discuss how to fix the above-mentioned problems.
Step 6: Tying up loose ends.
First, we are going to start off modifying the Validator.php file, and then we are going to re-index our Magento modules.
Modifying the Validator.php File
Go to file explorer and go to:
C:\xampp\htdocs\Magento\vendor\magento\framework\View\Element\Template\File
Open Validator.php in a code editor like Notepad++. I do not recommend opening in regular notepad, although it should work just the same.
Search for:
$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)); //EH0219Best 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:Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink
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. |
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.