Warning on creating virtual host
Posted by: ayand04 (---.alliancebroadband.in)
Date: January 07, 2017 11:52AM

Windows version used: 10 (x64)
Version WampServer: 3.0.6
Apache Version: 2.4.23
PHP Version: 5.6.25
MySQL Version: 5.7.14
What color is the WampServer icon: GREEN

Hosts file has:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
# 102.54.94.97 rhino.acme.com # source server
# 38.25.63.10 x.acme.com # x client host

# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost




Do you have access to localhost (Homepage WampServer)?: Yes
Do you have access to phpMyAdmin?: Yes
If you use an Antivirus and / or Firewall, please include the names of these: Escan
What is the full path to the installation of WampServer: C:\wamp64\

httpd-vhosts.conf:

# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#


<VirtualHost *:80>
ServerName filebucket
DocumentRoot "c:/wamp64/www/filebucket"
<Directory "c:/wamp64/www/filebucket/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>









I have made a clean install of wamp 3.0.6 and installed all the distributables properly. But when I create the virtual host I get the following warning (as in my PHP error log) :

[07-Jan-2017 10:02:47 UTC] PHP Warning: fopen(C:\\Windows\\system32\\drivers\\etc\\hosts): failed to open stream: Permission denied in C:\wamp64\www\add_vhost.php on line 338

[07-Jan-2017 10:02:47 UTC] PHP Stack trace:

[07-Jan-2017 10:02:47 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0

[07-Jan-2017 10:02:47 UTC] PHP 2. fopen() C:\wamp64\www\add_vhost.php:338

[07-Jan-2017 10:02:47 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp64\www\add_vhost.php on line 339

[07-Jan-2017 10:02:47 UTC] PHP Stack trace:

[07-Jan-2017 10:02:47 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0

[07-Jan-2017 10:02:47 UTC] PHP 2. fwrite() C:\wamp64\www\add_vhost.php:339

[07-Jan-2017 10:02:47 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp64\www\add_vhost.php on line 376

[07-Jan-2017 10:02:47 UTC] PHP Stack trace:

[07-Jan-2017 10:02:47 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0

[07-Jan-2017 10:02:47 UTC] PHP 2. fclose() C:\wamp64\www\add_vhost.php:376


What to do to sort this issue?



Edited 2 time(s). Last edit at 01/07/2017 03:05PM by ayand04.

Options: ReplyQuote
Re: Warning on creating virtual host
Posted by: Otomatic (Moderator)
Date: January 07, 2017 02:00PM

Hi,

- 1 - Please READ (and answer) BEFORE YOU ASK A QUESTION

- 2 - See errors in php log

- 3 - Apply item 09 and Note (2) of TROUBLESHOOTING TIPS

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Warning on creating virtual host
Posted by: ayand04 (---.alliancebroadband.in)
Date: January 07, 2017 02:56PM

I have updated the primary question.

Options: ReplyQuote
Re: Warning on creating virtual host
Posted by: Otomatic (Moderator)
Date: January 07, 2017 03:05PM

Hi,

The C:\Windows\System32\drivers\etc\hosts file must be :
127.0.0.1 localhost
::1 localhost

127.0.0.1 filebucket
::1 filebucket

Please do not edit your first post in response to the questions. No information warns that the message has been modified.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: Warning on creating virtual host
Posted by: ayand04 (---.alliancebroadband.in)
Date: January 07, 2017 03:10PM

Ok, I understand that the hosts file should be like the one you stated but do I need to change it manually every time I create a new vhost? And why are the above warnings being thrown and how can I fix them for the future?



Edited 1 time(s). Last edit at 01/07/2017 03:20PM by ayand04.

Options: ReplyQuote
Re: Warning on creating virtual host
Posted by: Otomatic (Moderator)
Date: January 07, 2017 04:08PM

Hi,

Quote
ayand04
Ok, I understand that the hosts file should be like the one you stated but do I need to change it manually every time I create a new vhost?
In this case, because the hosts file was not writable, you need to change it manually

Quote
ayand04
And why are the above warnings being thrown and how can I fix them for the future?
Apply my previous answers item - 2 - and - 3 -.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.