Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

archi_23's avatar

Unable to add virtual host in wamp server

I have added a project under wamp64/www folder. When I try to add the project as virtual host, its showing some error like Warning: fopen(C:/WINDOWS/system32/drivers/etc/hosts): failed to open stream: Permission denied in C:\wamp64\www\add_vhost.php on line 429

0 likes
4 replies
archi_23's avatar

I did as the same way as ur mentioned article. but after clicking its showing error like there's some problem in wamp64/www/add_vhost.php file.

Tray2's avatar

Are you actually trying to update the windows hosts file from php?

That is a really bad idea, that file is protected and can only be updated by an administrator.

It might be possible to work around but I would not attempt it since.

  1. Windows only
  2. Security issues
  3. Security issues
  4. Security issues
  5. Security issues
  6. Security issues
  7. Security issues
  8. Security issues
  9. Security issues
  10. Security issues
  11. Security issues

A hacker can basically add entries to the hosts file and redirect any site they want including phising site where they then will be able to get your bank information and any other sensitive stuff.

jlrdw's avatar

Open host file as admin in notepad.

Please or to participate in this conversation.