Jump to content

Windows HOSTS File And PHP


glenelkins

Recommended Posts

Hi

I am writing a script that adds virtual hosts to apache web server. Currently the script opens httpd.conf perfectly and adds in the new virtual host to the bottom of the file as such:

[code]
<VirtualHost *:80>
    ServerName servernamehere.com
    DocumentRoot document/root/folder/here
    ServerAdmin [email protected]
    ServerAlias serveraliashere
</VirtualHost>
[/code]

Now i need to go in and edit the HOSTS file in the system32/drivers/etc folder. When i try opening this file in php code the result is not the content of the file but some random warning messages etc.

Any ideas?

Also, once i have added into the HOSTS file is there a way to enable the new virtualhost without rebooting the machine? simply restarting apache does not work with the HOSTS file

Link to comment
https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/
Share on other sites

This is the output of the script when trying to open the HOSTS file

[quote]
# IMPORTANT # # This is the main Apache server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information about # the directives. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # # After this file is processed, the server will look for and process # srm.conf and then access.conf # unless you have overridden these with ResourceConfig and/or # AccessCon[/quote]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.