As a full-time Web Developer I am constantly adding fake domains to my Windows 7 HOSTS file to point a domain to my localhost web server that I develop on.
I have even built a nice little PHP script that lets me enter in the domain name I want to create, for example testing.dev
My script then creates...
- appropriate folders for this new website in my server directory
- VirtualHosts record in Apache (actually uses a Wildcard setup /projects/testing.dev/www/)
- Creates a MySQL database
testing.dev
and associates a MySQL User to this new DB - Lastly I have a small .EXE file that gets passed in a variable "testing" and it then edits my Windows HOSTS file and addes an entry on a new line like this... 127.0.0.1 testing.dev which then allows me to acces my new project site in the browser at http://testing.dev
This setup has worked amazingly for the past 2 years but recently my .EXE program has quit working...upon inspection if I browse to the folder C:\Windows\System32\drivers\etc
and view the properties for the hosts
file in this folder, the first problem I see is the read-only checkbox is checked, which is not allowing my simple exe program to modify the hosts file and add my new entries.
I then have to un-check read-only and manually add in my new hosts file changes and save, which then works fine. THe whole point of having a custom .exe program that takes 1 parameter (the domain name) is to be able to built scripts like this to automate the editing of my hosts file and work it into workflows like I have done.
Everytime I change this setting by un-checking the read-only property and apply/save it, within minutes it seems to have reverted back to being checked!
I would really appreciate any help in making my un-checked status to stick and stay that way, any ideas, suggestions, or even better a real solution to my problem anyone?
Also just to mention I do not have any kind of firewall or security programs that would be doing this, no 3rd part stuff running which would cause this.
Thanks for any help
No comments:
Post a Comment