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
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
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:
Below this line, add the following:
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:
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.