The Hosts file is used by the operating system to map human-friendly hostnames to numerical Internet Protocol (IP) addresses which identify and locate a host in an IP network. The Hosts file contains lines of text consisting of an IP address in the first text field followed by one or more hostnames. If the Hosts file is changed from the default, resetting it can help resolve some connectivity issues.
Your hosts file is missing from your computer, check here C:/WINDOWS/system32/drivers/etcto find the host file. If not,follow these steps to solve this issue.
Create a new text file using notepad, paste the following code in it and save it as hosts without any extension (if the .txt extension appears in the file, remove the .txt extension). After saving, move the file to C:/WINDOWS/system32/drivers/etc folder. Start Wamp server and check the error has gone. You can also check this help from Microsoft.
# Copyright (c) 1993-2006 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 handle within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
The "hosts file not writable" error in WampServer typically occurs because the hosts file in your Windows operating system is set to read-only, preventing WampServer from making changes to it. The hosts file is a system file that maps hostnames to IP addresses and is commonly used to override DNS settings.
To resolve this error, you can try the following steps:
-
Run WampServer as Administrator:
- Right-click on the WampServer shortcut or executable.
- Select "Run as administrator" from the context menu.
- This allows WampServer to have the necessary permissions to modify system files like the hosts file.
-
Manually Edit the Hosts File:
- If running WampServer as administrator doesn't resolve the issue, you can manually edit the hosts file.
- Navigate to the hosts file location: C:\Windows\System32\drivers\etc.
- Right-click on the hosts file and select "Properties."
- Uncheck the "Read-only" attribute if it's checked.
- Click "Apply" and then "OK" to save the changes.
- Try running WampServer again.
-
Check Antivirus or Security Software:
- Sometimes, antivirus or security software can interfere with system files and settings.
- Temporarily disable any antivirus or security software you have installed and see if the issue persists.
-
Modify Permissions:
- If the issue persists, you can manually modify the permissions of the hosts file to allow WampServer to write to it.
- Right-click on the hosts file and select "Properties."
- Go to the "Security" tab and click on "Edit" to change permissions.
- Select your user account or the Administrators group and grant "Full control" permissions.
- Click "Apply" and then "OK" to save the changes.
After performing these steps, try restarting WampServer and see if the error persists. If you continue to encounter issues, you may need to seek further assistance or consult WampServer's documentation or support resources.