I’m following the instructions as described in “Jump Start PHP Environment” by Bruno Skvorc.
I’ve installed Virtualbox, Vagrant and Git.
Now I need to add new hosts to the file “hosts” in the folder C:\Windows\System32\drivers\etc
I open the file as an administrator add the suggested host as described in the book…
192.168.10.10 homestead.app
and then I try to save it.
However, I am unable to change the contents as shown in a message:
“Cannot access hosts file because it’s being used by another process”
I use Notepad++ and it has “recent files” eg. if I’m working on “somefile.html” for a while and then I want to work on “somefile.css” for a while I can close the “somefile.html” tab. Later if I don’t want to navigate back to the “somefile.html” file to work on it some more, I can open it from “recent files”
In other words, Notepad++ keeps the file in its memory.
But I’m now wondering if you might have a localhost server running in the background as a service that is tying up the hosts file.
That’s because you can’t modify anything under the System32 folder while it’s running. You have to copy&paste the hosts file to the Desktop and modify it there, save your work, and then replace the old hosts file with the new one and you have to click on Continue when it prompts you the message asking you some general stuff.
I’m guessing clicking on “Try again” will prompt the same message. I think you can use Take Ownership for this. Not sure if it actually works as I rarely use it since my first installations are always successful.
On a side note, if this isn’t on a VM, you can simply pop in a bootable USB or a DVD that has a copy of some sort of Linux OS, and use the live demo. You can then modify the hosts file from the Linux OS and save it directly into System32. I haven’t tried this yet, but I assume it will work. I’ll try it now.
Sorry for the long wait. I confirmed that you can do it via a Linux OS. I just ran my Ubuntu 15.10 DVD and it works just fine.