Add a Virtual Host...
Posted by: Claudius (---.bardstown.com)
Date: August 20, 2018 04:49PM

OK...


Win 10- Pro 64 bit, v1803, Clean Install. All the recommended C++ redistributables are present 64 and 32 bit versions. Uninstalled Skype and some of the other foolishness that Microsoft bundles.

Running WAMP Server 3.1.3, just downloaded this morning, local...


Apache 2.4.33
PHP 5.6.35
MySQL 5.7.21
Maria DB 10.2.14

The WAMPServer icon in the system tray is green.


++++++++++++++++++++++++++++++++++++++++++++++++++


Assuming I am reading the instructions in the "All You Need Top Know" post, I create a file folder at the Root of a storage array attached to this computer using File Explorer running as an administrator. I navigate to the WAMPServer Homepage and attempt to "Add a Virtual Host."


I add the name of the Virtual Host on the first line and the path to the virtual host folder on the second like and I get:

( ! ) Warning: fopen(C:\\WINDOWS/system32/drivers/etc/hosts): failed to open stream: Permission denied in C:\wamp64\www\add_vhost.php on line 442

Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp64\www\add_vhost.php on line 443

and...

Sorry, I missed the last part of the error.

Anyway, my take is that the "Add a Virtual Host" Function does not have permission to modify the "Hosts" file. And I'm sure that whatever it is that I'm failing to do is superficial and something that ought to be obvious.


Can you help me out with this one?

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: RiggsFolly (Moderator)
Date: August 20, 2018 04:56PM

Hi

Often this is caused by your virus checker protecting the HOSTS file.
You may have to amend your virus checkers config so it either allows access for a few minutes or stops gaurding the HOSTS file completely

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: Claudius (---.bardstown.com)
Date: August 20, 2018 06:02PM

OK...

It wasn't the antivirus software.

I uninstalled WAMPServer. Then turned the antivirus and firewall software, my case Zonealarm.

Then with the antivirus and firewall off, reinstalled WAMPServer, created the required file folder at C:/wamp64/www/<foldername>.

Navigated to localhost via the WAMpserver icon in the system tray and attempted to create the virtual host again but ended up with the same three errors.

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: Otomatic (Moderator)
Date: August 20, 2018 06:10PM

Hi,

See errors in php_error.log
- Left-Click Wampmanager tray icon -> PHP -> PHP error log

See (Note 2) in TROUBLESHOOTING TIPS

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

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: Claudius (---.bardstown.com)
Date: August 20, 2018 06:28PM

[20-Aug-2018 15:50:52 UTC] PHP Warning: fopen(C:\WINDOWS/system32/drivers/etc/hosts): failed to open stream: Permission denied in C:\wamp64\scripts\refresh.php on line 402
[20-Aug-2018 15:50:52 UTC] PHP Warning: flock() expects parameter 1 to be resource, boolean given in C:\wamp64\scripts\refresh.php on line 403
[20-Aug-2018 15:50:52 UTC] Unable to write to C:\WINDOWS/system32/drivers/etc/hosts file
[20-Aug-2018 15:50:52 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp64\scripts\refresh.php on line 412
[20-Aug-2018 15:52:13 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 442

[20-Aug-2018 15:52:13 UTC] PHP Stack trace:

[20-Aug-2018 15:52:13 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0

[20-Aug-2018 15:52:13 UTC] PHP 2. fopen() C:\wamp64\www\add_vhost.php:442

[20-Aug-2018 15:52:13 UTC] PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in C:\wamp64\www\add_vhost.php on line 443

[20-Aug-2018 15:52:13 UTC] PHP Stack trace:

[20-Aug-2018 15:52:13 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0

[20-Aug-2018 15:52:13 UTC] PHP 2. fwrite() C:\wamp64\www\add_vhost.php:443

[20-Aug-2018 15:52:13 UTC] PHP Warning: fclose() expects parameter 1 to be resource, boolean given in C:\wamp64\www\add_vhost.php on line 480

[20-Aug-2018 15:52:13 UTC] PHP Stack trace:

[20-Aug-2018 15:52:13 UTC] PHP 1. {main}() C:\wamp64\www\add_vhost.php:0

[20-Aug-2018 15:52:13 UTC] PHP 2. fclose() C:\wamp64\www\add_vhost.php:480

+++++++++++++++++++++++++++++++++++++++++

How do you heel about starting the machine up in safe mode and attempting the edit to the hosts file manually?

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: Otomatic (Moderator)
Date: August 20, 2018 07:14PM

Hi,

Did you read (Note 2) ?

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

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: Claudius (---.bardstown.com)
Date: August 21, 2018 01:21PM

And so...

Here's what I did. Another clean install of Win 10 Pro. Download and install as Administrator all of the required Windows C++ redistributable files.

The Check_Vredist.exe program indicates that the 2008 redistributables are missing although these redistributables are present. I attempted to reinstall the 2008 redistributables and the install wizard came back with the "repair" or "remove" dialog.

With a fresh installation of Win 10 Pro and after installing all of the redistributables I started Windows File Explorer as an Administrator, Navigate to the "explorer.exe" file in the "Windows" folder, right click and select, "Run as Administrator" then navigate to the "C:/windows/system32/drivers/etc" folder, right click the "Hosts" file and allow unrestricted access to the "Hosts" file.

Install WAMPserver as per instruction and create the desired Virtual Host folder.

Launch the WAMPServer per instruction and create the virtual host.

Stop the WAMPServer, open File Explorer again as an administrator, navigate to the Hosts file and restore the file's original permissions.

Options: ReplyQuote
Re: Add a Virtual Host...
Posted by: Otomatic (Moderator)
Date: August 21, 2018 04:06PM

Hi,

> The Check_Vredist.exe program indicates that the 2008 redistributables are missing although these
> redistributables are present.
If vcredist says redistributables are missing, they are missing. Those who are present are not the right version.
Microsoft has the habit of changing redistributable links without warning or putting a link on the correct version.
All "good" VC++ redistributable versions are on http://wampserver.aviatechno.net in the section Visual C++ Redistribuable Packages

> navigate to the Hosts file and restore the file's original permissions.
Why ?

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

Options: ReplyQuote


Sorry, only registered users may post in this forum.