cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot install Magento 2 on Windows 7 localhost using XAMPP [RESOLVED]

SOLVED

Cannot install Magento 2 on Windows 7 localhost using XAMPP [RESOLVED]

This is on Windows, so the usual advice regarding chmod etc doesn't apply. Here is what I did to try, does anyone have any suggestions please?

 

1. Set up an Apache URL in XAMPP (7.0.8) - I used http://localhost/www.example.com with httpd.conf entry

Alias /www.example.com "E:\www\magento\www.example.com"
<Directory "E:\www\magento\www.example.com">
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Order allow,deny
Allow from all
RewriteEngine On
</Directory>

(Added a file showing phpinfo() there to prove basic serving & php works).
In particular, ensure the phpinfo() page confirms apaches mod_rewrite is enabled.

2. In MySql, "create database magento_example;"
3. From https://www.magentocommerce.com/download, Download Community Edition 2.1.1 zip
4. Unzip  to E:\www\magento\www.example.com
5. Before commencing, edit app\etc\di.xml so the "view_preprocessed" value is changed from "Symlink" to "Copy"

Before:
item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
After:
item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>

6. Visit http://localhost/www.example.com/setup & begin - ensure readiness check passes 100%
7. Complete the database setup appropriately
8. Note the generated admin URL
9. Customise the locale if required
10. Create admin acc & proceed. Observe "success" message when done.
11. Click launch Magento Admin. Observe 404.
12. Visit http://localhost/www.example.com. Observe unstyled page. Click "Sign in". Observe 404. Click "Privacy Policy." Observe 404.
13. View source. Click link for a sample CSS - e.g. calendar.css. Observe 404.
14. Note: Situation currently identical to https://community.magento.com/t5/Just-Ask-Alan/Magento-2-front-amp-backend-returning-404-error-after...
14. Delete all files in var/cache, pub/static (except .htaccess)
15. In root of site, "php bin/magento setup:static-content:deploy"
16. Using Chrome, Switch Person | Browse as Guest to eliminate browser cache/cookie problems
17. Observe many files copied, yet after completion still same as (12)
18. Check /var/log - observe only 2 files, debug.log and install.log, both of which are full but don't provide anything useful.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

I finally worked out what was wrong here and so am posting the fix for anyone searching in the future. Magento 2 works fine on Win 7 and always did. Sincere thanks to all who made suggestions, all of which are valid given the information I supplied.

 

The problem was vhosts. In my initial description, I didn't realise the significance of NOT using the extra/httpd-vhosts.conf file to set up the local Magento installation. This is because with Joomla you don't need to, everything can be in a subdirectory. Local URLs without vhosts look like http://localhost/www.example.com, and the def is all done in the main httpd.conf file. If you do this with Magento 2, it will fail with the broken symlinks as described in my post. What you must do is properly set up a vhost for the installation, which is probably what everyone else on the forums etc was always doing, hence my frustration at constantly being told to try things which wouldn't help. The local URLs in this case look like http://www.example.com.localhost, or whatever name you choose. Note you must also add an entry into the windows hosts file this way whereas with the (failing) subdir method you don't. If anyone does know a fix when using the subdir approach I would still be interested, but for anyone encountering these symptoms make sure you have XAMPP set to use vhosts.

View solution in original post

6 REPLIES 6

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

Hi @bdamage

 

Please go through following forum post https://community.magento.com/t5/Installing-Magento-2/Installation-sucessfully-but-I-can-t-use-the-M...

 

If I am not wrong you are facing 404 for the front end css and js files as well as unable to login to the Magento admin?

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

Hi muk_t

 

Thanks very much for your reply. The symptoms are exactly as described in that link, yes. The poster there is using Ubuntu Linux. I am using Windows. The fixes suggested all relate to Linux, including the one at http://devdocs.magento.com/guides/v2.1/install-gde/trouble/tshoot_access-browser.html. Is there any docs specifically for fixes for this on Windows?

 

Thanks

 

- Bill

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

Hi @bdamage

 

Can you try reinstalling Magento2 once again. This time just make changes to allow override all and deploy static content.

Also use use 127.0.01 instead of localhost and see if it works for you.

 

You should not edit app/etc/di.xml file. Also refer http://devdocs.magento.com/guides/v2.0/install-gde/trouble/tshoot_no-styles.html

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

Sincere thanks again for your help.

 

I did all that again except didn't change di.xml and used 127.0.0.1. The results were the same. Reading round most of the links still show answers for Linux for these problems.

 

I'm beginning to think Magento 2 just does not work on Windows 7 at all. The lack of any mention in the documentation is suspicious. If it doesn't, I don't mind because at least it means I can stop wasting time trying. I have working Linux installs.

 

Perhaps I should explain what I really want in case there is a better way. I'm looking after a team which develops various CMS sites such as Joomla, WP & custom setups. We have a workflow which is automated so the files for the CMS, and the databases, can go from a developers PC -> staging server -> production. All code is versioned and that's the only way it moves across this path. All staging and production servers are Linux. The CMS usually has just one control file which is local to the install that isn't versioned, e.g. Joomla has configuration.php, it seems the /app/etc/env.php plus entries in core_config_data perform a similar "localisation" role for Magento 2. Great! Rollouts can be scripted. Using this, I've succeeded in versioning the Linux installs of the Magento 2 site to staging and could roll them to production when needed.

 

The problem is half the devs are on Windows laptops/PCs, and some are not developers - they just do content. Running a VM locally isn't ideal because that would mean everyone has to set one up just for Magento 2.

 

Now I've shown the rollout to staging etc will work, all I need is to get it up and running on Windows and we'll be happy.

 

Thanks

 

-- Bill

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

Is the way I am installing Magento 2 incorrect?

 

Does anyone know a step by step guide to installing Magento 2 on Windows please?

Re: Cannot install Magento 2 on Windows 7 localhost using XAMPP

I finally worked out what was wrong here and so am posting the fix for anyone searching in the future. Magento 2 works fine on Win 7 and always did. Sincere thanks to all who made suggestions, all of which are valid given the information I supplied.

 

The problem was vhosts. In my initial description, I didn't realise the significance of NOT using the extra/httpd-vhosts.conf file to set up the local Magento installation. This is because with Joomla you don't need to, everything can be in a subdirectory. Local URLs without vhosts look like http://localhost/www.example.com, and the def is all done in the main httpd.conf file. If you do this with Magento 2, it will fail with the broken symlinks as described in my post. What you must do is properly set up a vhost for the installation, which is probably what everyone else on the forums etc was always doing, hence my frustration at constantly being told to try things which wouldn't help. The local URLs in this case look like http://www.example.com.localhost, or whatever name you choose. Note you must also add an entry into the windows hosts file this way whereas with the (failing) subdir method you don't. If anyone does know a fix when using the subdir approach I would still be interested, but for anyone encountering these symptoms make sure you have XAMPP set to use vhosts.