Troubleshoot Apache Startup Problems

Documentation

Troubleshoot Apache Startup Problems

Are you having difficulty getting your Apache server started? Here is a list of common problems and their solutions.

The information in this document is based on this ApacheFriends community forum thread.

Port 80 in use by PID 4

Your XAMPP control panel displays this message:

XX:XX:XX [Apache] Port 80 in use by "Unable to open process" with PID 4!

To solve this problem, follow these steps:

  1. Right-click the XAMPP control panel icon and select "Run as administrator". Enter administrator credentials (if required) and click "OK" or "Yes" to proceed.

  2. Open your Windows command prompt by clicking the "Shell" button in the XAMPP control panel.

  3. At the command prompt, enter this command:

    netsh http add iplisten ipaddress=::
  4. Open the file C:\Windows\system32\drivers\etc\hosts and add the following line to it. Then, save the file.

    127.0.0.1  localhost
    image1

    This takes care of mapping the localhost domain name to the local machine, which always has the IP address 127.0.0.1.

On some versions of Windows, you will not be able to edit the C:\Windows\system32\drivers\etc\hosts file without administrator privileges. You can edit the file by right-clicking the Notepad icon and selected the "Run as administrator" menu option, then entering administrator credentials (if required) and clicking "OK" or "Yes" to proceed.
If the problem persists even after performing these steps, it could be due to a problem with Microsoft Internet Information Services (IIS), with Windows Work Folders or with third-party services. Refer to this page for alternative solutions.

Ports 80 and 443 in use by Skype

Your XAMPP control panel displays these messages:

XX:XX:XX [Apache] Port 80 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID XXXX!
XX:XX:XX [Apache] Port 443 in use by "C:\Program Files (x86)\Skype\Phone\Skype.exe" with PID XXXX!

To solve this problem, follow these steps:

  1. Launch Skype.

  2. Select the "Tools → Options → Advanced → Connection" menu item and in the resulting screen, disable the use of ports 80 and 443 for incoming Skype connections.

    image2
  3. Click "Save". Restart Skype for your change to take effect.

Port 443 in use by VMWare

Your XAMPP control panel displays these messages:

XX:XX:XX [Apache] Port 443 in use by ""C:\Program Files (x86)\VMware\VMware Workstation\vmware-hostd.exe" -u "C:\ProgramData\VMware\hostd\config.xml"" with PID XXXX!

To solve this problem, follow these steps:

  1. Launch VMWare Workstation.

  2. Use the "Edit → Preferences → Shared VMs" menu and in the resulting dialog, enter a new port number for the VMWare Workstation Server.

  3. Click "OK" to save your changes. Restart VMWare Workstation for your change to take effect.

ServerRoot Must Be a Valid Directory

Apache startup includes an error message like the one below:

httpd.exe: Syntax error on line XX of X:/xampp/apache/conf/httpd.conf: ServerRoot must be a valid directory

This is a common issue for XAMPP installations on portable devices. It occurs if the Apache configuration file points to a directory that no longer exists (for example, due to a drive letter change when a portable device is removed and reinserted). To solve this problem, follow these steps:

  1. If the Apache service is registered (indicated by a green check mark next to its name in the XAMPP control panel), unregister it by clicking the check mark and answering "Yes" in the resulting dialog box.

    image3
  2. Edit the setup_xampp.bat file in your XAMPP installation directory (usually, C:\xampp). Within the file, find this line:

    %PHP_BIN% -n -d output_buffering=0 %CONFIG_PHP%
  3. Edit the line to include the special directive "usb" at the end, so that it looks like this.

    %PHP_BIN% -n -d output_buffering=0 %CONFIG_PHP% usb
  4. Save your changes. The, execute the file by double-clicking it in the Windows Explorer or executing it at the command prompt. This will fix any and all wrong base paths.

XAMPP cannot start on port 80 (Windows 10)

By default, Windows 10 starts Microsoft IIS on port 80, which is the same default port used by Apache in XAMPP. As a result, Apache cannot bind to port 80.

To check whether port 80 is in use, open a command prompt and run these commands:

netstat -o -n -a | findstr 0.0.0.0:80
netstat -o -n -a | findstr 127.0.0.1:80
image4

To disable IIS from running on port 80, follow these steps:

  1. Open the Services panel in Computer Management.

  2. Search for the "World Wide Web Publishing Service" and select it.

  3. Click the link to "Stop the service".

    image5
  4. Double-click the service name.

  5. In the "Startup type" field, change the startup type to "Disabled".

    image6
  6. Click "OK" to save your changes.

You should now be able to start Apache in XAMPP on port 80.

The Microsoft Edge browser cannot be used to access local addresses using the machine host name.

If your local machine has the host name 'myhost', you will not be able to access URLs such as http://myhost in Microsoft Edge. To resolve this, you should instead use the addresses http://127.0.0.1 or http://localhost.

image7
image8