Apache httpd.conf changes ignored in Windows 7

VirtualStore in Windows 7 causes problems

Feature? Hack? Or hugely misguided mistake?

Imagine this: You are a web developer. You buy a brand new computer running Windows 7. You install Apache using all the default installation options. You fire up your browser to see Apache’s “It works!” test page …so it does, Apache. Awesome.

You edit httpd.conf to point to your latest web project, restart Apache, refresh the browser. Which still shows It works! … not your project. Hmm. No startup errors in the Apache error.log …. you close & reopen httpd.conf & your changes still look good. Apache still shows It works! In a mad rage you delete all settings in httpd.conf & bang out some undocumented 4-letter profanity settings guaranteed to throw Apache startup errors. Restart Apache. It works! No, Apache, it doesn’t!! What the fuck.

WTF is happening is a little-known feature, hack, & extremely bad idea from Microsoft in Windows 7 (and some other versions) called VirtualStore. VirtualStore should have been called VirtualStoreYourFilesElsewhereAndNotTellYou, because that’s what is occurring.

When you saved your edited httpd.conf file, Windows 7 secretly saved it in (deep breath) …

/Users/[Your User Name]/AppData/Local/VirtualStore/Program Files/Apache Software Foundation/Apache2.2/conf/httpd.conf

… and a hidden link gets created within your Program Files folders to the VirtualStore copy. Normally this works okay with legacy Windows programs, but apparently with Apache running as a service, it doesn’t pick up the VirtualStore link.

The upshot is while you continue madly editing your VirtualStore’d httpd.conf, Apache continues reading the original, which you are secretly being prevented from editing. How are you supposed to know what’s going on? Take a look …

Awful VirtualStore Warning

Microsoft's alert that VirtualStore files exist

Yea. One little icon in the action bar. Not at all noticeable.

(Microsoft should consider using my patented red oval).

No indication of which files are “Compatibility Files”.

And apparently, the linked file system doesn’t work consistently. What a stupid feature. It’s a hack, really, trying to blindly protect an operating system infamous for core-level security flaws.

How about a simple warning that the VirtualStore hack was occurring? Or ditch VirtualStore & display a UAC-style dialog, “Program X wants to write to Program Files, cancel or allow?” Even cancel or allow would be an improvement.

run as Administrator

Don't forget this minor detail.

What triggered VirtualStore in the first place? Way back when you fired up your text editor, you needed to run it in Administrator mode. Only then does it have the ability to save files directly under the protected Program Files folder structure without VirtualStore links.

How to fix the VirtualStore mess — First, move your Apache config file(s) out of the VirtualStore folder structure. Then delete the Virtualstore/Apache Software Foundation/ folder. That removes the “Compatibility Files” links from the real directory. Then you can run your text editor in Administrator mode & redo your Apache config edits.

Or even better: right-click on the folder that contains the files you want to edit, click Properties, Security tab & give Full Access privileges to your Windows user.

Notepad (& possibly Wordpad) won’t trigger VirtualStore — instead they’ll simply throw a “permission denied” error until you switch to Administrator mode. Most third-party editors like Komodo Edit will silently generate the VirtualStore’d copies until you run them in Administrator mode.

You can see which of your applications are being VirtualStore’d by opening Task manager, Processes tab, View menu, “Select Columns…”, check Virtualization. Back at the task list, any process with “Enabled” in the column means you’re in for some VirtualStore fuckedupedness.

Best part: VirtualStore isn’t just for files — any program attempting to write to the registry under the HKEY_LOCAL_MACHINE\Software branch will be VirtualStore-slapped over to HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\Software

Hope this helps someone! As someone commented on another blog, “I really hate how Microsoft surprises you with their new retarded ways of keeping us safe from ourselves.” Amen to that.

If you have Windows 7 Professional, Ultimate, or Enterprise editions, you can disable VirtualStore completely through the Local Policy Editor. This may prevent some legacy programs from running, however.

For more, see VirtualStore is horrible. How do you disable it in Windows 7.

This entry was posted in bugs, tips, Windows 7 and tagged , , , . Bookmark the permalink.

20 Responses to Apache httpd.conf changes ignored in Windows 7

  1. Ray says:

    this is very much true – it took me hours to find out what happend with my apache installation. It drove me mad.
    Thanks a lot for this very helpful post.

    Ray

  2. ignacio says:

    Thanks so much for this useful piece of information. I spent a good hour last night battling this issue after having installed Apache on Windows 7. Once I found your post and gotten rid of the “Apache Software Foundation” inside the virtualStore folder, everything went as smooth as it should’ve gone.

  3. Ellswrth says:

    This was a godsend – I could have spent another three days trying to figure this out.

  4. Wick says:

    @ignacio & @Ellswrth, thank you — glad to hear it helped someone else. Aside from VirtualStore being a pretty awful idea to begin with, I think it’s crazy (as in crazy-stupid) that Microsoft doesn’t display a far more noticeable alert about it when it’s occurring.

  5. Stefan says:

    I love you ;-)

  6. Pingback: Windows 7: Apache Configuration Changes Ignored | ScotchAndCoffee Tech Talk

  7. Bodo K. says:

    Thanks a lot! This really saved me from getting insane!!!

    Windows 7 is like taking part in a Formula One race and while the others are starting you realize, that you do not have a motor.

  8. Vivian De Smedt says:

    Thanks for your post I would never had solve the problem without you.

  9. m says:

    thanks for this, i was going crazy and you led me on the right path.
    after googling a bit i found a simpler solution, i reinstalled apache out of the program files folder directly on c:/ which bypasses the whole problem as it only affects the program files folder…

  10. NTal says:

    This fucking windows 7 really drove me made with Apache PHP configuration. Somebody please kill this bloody OS.

    NTal

  11. Diogenes says:

    Thank you for posting this.

    I have now pretty much spent a whole day discovering the wonders of the MS virtual store; a day that I’ll never get back. Like you, I tried to edit the Apache config file, and was absolutely confounded when my edited file did not appear in reality. I closed down and reopened my editor, which has last files recall, and my changes were still there!

    And I kept getting It works.. NO, it doesn’t!

    I have it working now. I think I have this figured out. Nice move Microsoft. I really didn’t expect an operating system to be as deceptive as a virus, but you did it. Congratulations.

    This is the last time I pay for any official Windows OS. What a bunch of bullshit! May I suggest that this Virtual Store was the jump the shark move for Micro$oft? Die, Micro$oft, die!

    I’ll install a bootleg copy of XP before I have to deal with this again. M$ doesn’t sell XP licenses anymore, so I really don’t have much of a choice if I need something that works out of the box with a minimum of fuss.

  12. William says:

    Muchas gracias!!!! Me has ayudado mucho

  13. Henrik says:

    Thanks!!!

  14. Jacob Persico says:

    Thank you so much. I was looking for help on this and I was having trouble finding it. When I found this article after searching for a while I was so pleased.

    Microsoft shouldn’t have done this. This is so retarded. I like Windows XP the best.
    I thought the data in http.conf was being cached some where.
    I don’t see the point of letting you edit the file then swopping it with the old version. This doesn’t make sense.

    This was so helpful.
    Microsoft does some really stupid messed up things.

  15. Jacob Persico says:

    Sorry to say it still wont work. I thought I disabled VirtualStore for Apache. There is only 2 httpd.conf files I can find and nether one has the code that’s being used. Still the old version of httpd.conf is being used even though it doesn’t appear to exist. Of course I clear browser cache and restart Apache, but still no luck.

    • Wick says:

      Hi Jacob, did you ever figure out the problem? Make sure that the “Compatibility Files” menu bar option DOES NOT show up in Windows Explorer when you browse to the Apache2.2/conf/ folder. It sounds to me like it’s probably still using VirtualStore & is intercepting httpd.conf. The simple fact is Apache needs an httpd.conf to work…. good luck.

  16. Jacob Persico says:

    After giving up for a long while I did end up going back to trying to install Apache web server on my Windows 7 computer. I installed into “C:\programs\” instead of the default “C:\program files\” and because I didn’t use the “program files” folder it worked. One thing I had to do before it worked was disable an old outdated Apache service (Start Menu -> Type “services” -> press enter -> look for “Apache”), this service was left behind even though I had uninstalled the old Apache, it’s to bad programs don’t completely uninstall all the time when you run the uninstall. Anyway you could imagine how happy I was when it all worked perfectly. :-)

  17. Pingback: Can't edit apache2.2 httpd.conf on Windows 7 - Just just easy answers

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>