glenelkins Posted December 21, 2006 Share Posted December 21, 2006 HiI 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 More sharing options...
kenrbnsn Posted December 21, 2006 Share Posted December 21, 2006 Please post those "ome random warning messages etc", they are telling you what's wrong and why you can't open the file. They are important.Ken Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-145856 Share on other sites More sharing options...
glenelkins Posted December 21, 2006 Author Share Posted December 21, 2006 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] Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-145861 Share on other sites More sharing options...
glenelkins Posted December 21, 2006 Author Share Posted December 21, 2006 its ok its me being a dumb ass...sorted Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-145863 Share on other sites More sharing options...
kenrbnsn Posted December 21, 2006 Share Posted December 21, 2006 Those are not warning message, but lines from the httpd.conf file. Please post the script you are using between [nobbc][code][/code][/nobbc] tags.Ken Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-145865 Share on other sites More sharing options...
glenelkins Posted December 21, 2006 Author Share Posted December 21, 2006 Got it sorted, was me being dumb..ok so the next question would be, how do i update the HOST records without rebooting windows? Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-145868 Share on other sites More sharing options...
glenelkins Posted December 21, 2006 Author Share Posted December 21, 2006 any idea?? Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-145880 Share on other sites More sharing options...
glenelkins Posted December 21, 2006 Author Share Posted December 21, 2006 ? Link to comment https://forums.phpfreaks.com/topic/31483-windows-hosts-file-and-php/#findComment-146017 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.