[Q&A] Apache won't start

Problems with the Windows version of XAMPP, questions, comments, and anything related.

[Q&A] Apache won't start

Postby Altrea » 24. June 2014 17:37

What can you expect from this thread?

Apache starting issues are a very very common reason why threads will be created at this board.
In many cases users don't gave us sufficient information to analyze this problem properly.
This thread should help you to identify the specific issue and find solutions for it or at least give us more detailed information about the specific issue.

Problem

XAMPP Apache is not able to start after clicking the [Start] Button in your Control panel or executing the apache_start.bat script.
XAMPP control panel shows the following lines of code

XAMPP control panel wrote:XX:XX:XX [Apache] Status change detected: running
XX:XX:XX [Apache] Status change detected: stopped
XX:XX:XX [Apache] Error: Apache shutdown unexpectedly.
XX:XX:XX [Apache] This may be due to a blocked port, missing dependencies,
XX:XX:XX [Apache] improper privileges, a crash, or a shutdown by another method.
XX:XX:XX [Apache] Press the Logs button to view error logs and check
XX:XX:XX [Apache] the Windows Event Viewer for more clues
XX:XX:XX [Apache] If you need more help, copy and post this
XX:XX:XX [Apache] entire log window on the forums


Maximize debugging information

Solving Apache start issues without proper privileges can be very challanging. Running the control panel without elevated administrator rights results in lack of privileges to read out process data and service information. That makes it very difficult to identify the real reason why Apache cannot start.
Indicator for missing privileges are the following lines in your control panel

XAMPP control panel wrote:XX:XX:XX [main] You are not running with administrator rights! This will work for
XX:XX:XX [main] most application stuff but whenever you do something with services
XX:XX:XX [main] there will be a security dialogue or things will break! So think
XX:XX:XX [main] about running this application with administrator rights!

To solve that issue you have to restart your control panel with elevated administrator rights:
  • rightclick your xampp-control.exe file
  • choose "run as Administraor"
  • if UAC is enabled you need to confirm that you really want to run as Administrator
  • if you are not logged in as Administrator on your Windows system you need to type in the credentials of an administrator

Identify the specific issue

There are some ressources that helps to identify the specific issue.

Other control panel messages
The Control panel does some prechecks at start like port scans for needed ports. If any problems found they gets reported by the following schema

XAMPP control panel wrote:XX:XX:XX [Apache] Problem detected!
XX:XX:XX [Apache] Port XXX in use by "XXXXXXXXXXXXXXX" with PID XXXX!
XX:XX:XX [Apache] Apache WILL NOT start without the configured ports free!
XX:XX:XX [Apache] You need to uninstall/disable/reconfigure the blocking application
XX:XX:XX [Apache] or reconfigure Apache and the Control Panel to listen on a different port

The most important line of this block is the second line which can contain information about the blocking application file and process id (PID)
Here are some common blocking applications and their recommend solutions

XAMPP control panel wrote:XX:XX:XX [Apache] Port 80 in use by "Unable to open process" with PID 4!
Solution: [Q&A] solving Port 80 in use by PID 4 (http.sys) issue

XAMPP control panel wrote: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!
Solution: [Q&A] solving Port 80 & 443 in use by Skype issue

XAMPP control panel wrote: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!
Solution: [Q&A] solving Port 443 in use by VMWare issue

XAMPP control panel wrote:XX:XX:XX [main] XAMPP Installation Directory: "c:\program files (x86)\xampp\"
XX:XX:XX [main] WARNING: Your install directory contains spaces. This may break programs/scripts
XX:XX:XX [main] WARNING: Your install directory contains special characters. This may break programs/scripts


response of "\xampp\apache_start.bat"
This batch starts Apache in the command line and will always response specific information about starting issues, like this:

\xampp\apache_start.bat wrote:httpd.exe: Syntax error on line XX of X:/xampp/apache/conf/httpd.conf: ServerRoot must be a valid directory
Solution: [Q&A] solving ServerRoot must be a valid directory

\xampp\apache_start.bat wrote:(OS 5)Access is denied : AH00091: httpd.exe: could not open error log file C:/Program Files (x86)/xampp/apache/logs/error.log.
AH00015: Unable to open logs


Windows error windows
Cannot create file "C:\Program Files (x86)\xampp\xampp-control.ini". Access is denied


General Workaround for blocked ports: Changing Apache default ports

In almost all cases this should be the last solution you should use. Mostly there are better solutions which does not have any negative influences to your third party applications (See "Identify the specific issue").

If you still want to change the default ports, here is the way to do: [Q&A] Changing the Apache default ports

( To be continued - last edit 2014-11-11 )
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

[Q&A] solving Port 80 in use by PID 4 (HTTP.sys) issue

Postby Altrea » 25. June 2014 17:33

HTTP.sys is a proxy service to share HTTP ports (80, 443) with multiple programs (like virtualhosts would do too). Programs which are not mainly Webserver applications can register itself to that service to listen on specific HTTP traffic.
Badly, Apache can not use this service too.

There are two commands helping to identify the real program using HTTP.sys to block port 80, but they are very difficult to read

Showing reserved IRLs
Code: Select all
netsh http show urlacl

Showing active registered URLs
Code: Select all
netsh http show servicestate

To solve the problem we need to reconfigure or disable the program using HTTP.sys or HTTP.sys directly. There are several ways to do so, beginning with the most recommend.

Configure HTTP.sys to only bind to IPv6

Only bind to IPv6 has the advantage that HTTP.sys can still be used without influencing Apache on IPv4 anymore.

  • Open your Windows commandline with elevated administrative rights (rightclick -> run as Administrator)
  • type in the following command
    Code: Select all
    netsh http add iplisten ipaddress=::

If http://localhost will still not work after that, you need to resolve localhost to the IPv4 address 127.0.0.1

  • Open your notepad with elevated administrative rights (rightclick -> run as Administrator)
  • With File -> Open navigate to your \Windows\sytsem32\drivers\etc\ folder
  • change your filetype from Textfiles (*.txt) to All Files (*.*)
  • open your hosts file
  • add the following line
    Code: Select all
    localhost    127.0.0.1
  • Save the file

Configure IIS Default Page to bind to a different port

  • click Start
  • click Administrative Tools
  • click Internet Information Services (IIS) Manager
  • in the Connections pane expand the computer name
  • expand Sites
  • click Default Web Site
  • In the Actions pane, under Edit Site
  • click Bindings
  • In the Site Bindings dialog box, click the http entry
  • click Edit
  • In the Edit Site Binding dialog box, in Port, type your new port
  • click OK
  • In the Site Bindings dialog box, click Close
  • In the Actions pane, under Manage Web Site, click Stop, and then click Start
http://technet.microsoft.com/en-us/libr ... 24275.aspx

Configure Windows Work Folders to bind to a different port

Windows Work Folders is a new Sync Service implemented in Windows Server 2012 R2 and Windows 8 using ports 80 and 443 by default.
You can reconfigure that service to use a different port:

  • Start your Windows editor with elevated administrative rights (rightclick -> run as Administrator
  • Open the file C:\Windows\System32\SyncShareSvc.config
  • Search for the line <bindings> and change the bindings from port 80 and 443 to different ports, like 20080 and 20443
    Code: Select all
    <sites>
    [...]
        <bindings>
            <binding protocol="http" bindingInformation="*:20080:" />
            <binding protocol="https" bindingInformation="*:20443:" sslFlags="0" />
    [...]
  • save the file
  • open your commandline with elevated administrative rights (rightclick -> run as Administrator)
  • type in the following two commands to register the new bounded ports (ex here 20080 and 20443)
    Code: Select all
    netsh http add urlacl url=http://*:2080/ user="NT Authority\LOCAL SERVICE"
    netsh http add urlacl url=https://*:20443/ user="NT Authority\LOCAL SERVICE"
If you are using Work Folders, you should read this too: http://blogs.technet.com/b/filecab/arch ... lders.aspx

http://www.devside.net/wamp-server/open ... on-windows

Stop IIS Windows Services

  • IIS Admin Service (IISADMIN)
    Code: Select all
    net stop iisadmin

  • World Wide Web Publishing Service (W3SVC)
    Code: Select all
    net stop w3svc

  • Windows Process Activation Services (WAS)
    Code: Select all
    net stop was

Stop third party services known to use HTTP.sys

  • SQL Server Reporting Services (reportserver)
    Code: Select all
    net stop reportserver

  • BranchCache (peerdistsvc)
    Code: Select all
    net stop peerdistsvc

  • Sync Share Service (syncsharesvc)
    Code: Select all
    net stop syncsharesvc

Stop HTTP.sys services

  • Web Deployment Agent Service (msdepsvc)
    Code: Select all
    net stop msdepsvc

  • Stop Windows Service "http"
    Code: Select all
    net stop http

Disable HTTP.sys completely

This can influence important third party programs and services like printer spooler

  • Open Control Panel
  • Open Device Manager
  • in menu click on View
  • select: Show hidden devices
  • Open tree: Non-plug and Play Drivers
  • Double-click: HTTP
  • Tab Driver - Group Startup
  • Switch from: Demand to Disabled
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

[Q&A] solving Port 80 & 443 in use by Skype issue

Postby Altrea » 06. November 2014 07:36

Reconfigure Skype not to use Ports 80 & 443 as Fallback

Skype can easily be configured not to use the default Apache ports 80 & 443.
This change commonly has no sideeffects. In almost all cases Skype can work without them as before.

Image
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

[Q&A] solving Port 443 in use by VMWare issue

Postby Altrea » 06. November 2014 23:30

Reconfigure VMWare Workstation to use a different HTTPS port

  • In your VMWare Workstation click on Edit
  • click on Preferences
    Image

  • click on Shared VMs
    Image

  • click on change Settings
  • edit the Port or disable Sharing
    Image
  • click OK
  • Restart VMWare Workstation
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

[Q&A] Changing the Apache default ports

Postby Altrea » 11. November 2014 22:48

Changing the Apache ports has some sideeffects:

  • append port to every request
    the new port needs to be added to every request (e.g.: instead of http://localhost/xampp/index.php to request the orange XAMPP administration page with port 1234 you need to use this url http://localhost:1234/xampp/index,php. This is not needed for the default ports, because if no port is given the default ports based on the protocol (http://, https://, etc) is used.

  • XAMPP control panel configuration
    The control panel needs the information about the new ports, otherwise the Admin buttons and port prechecks will not work anymore

  • configurable Third Party Webapplications
    Most of the common cms webapplications or frameworks are using url builders based on a base url to generate hyperlinks. These webapplications need the information about the new port to work properly. Each Webapplication is different and we cannot provide any support for them =>
    [Q&A] How to not fail getting help here (Section: Scope of support)

  • unconfigurable Third Party Webapplications
    Some webapplications may not be able to run with different ports because they are hardcoded to the default ports
That is why we do not recommend to change the Apache ports if not really really needed. In almost all cases there are better solutions to get Apache running.

There are only a few reasons where i would recommend to change the default Apache ports:

  • Another webserver is and will still be your prefered default webserver on your system
  • the blocking application really needs the default webserver ports because your system is protected like fort knox
If you really want to change the Apache ports, here are the steps to be done.


Apache configuration

Depending on the used XAMPP installation the code parts to be searched and replaced can differ!
It is recommend to use a good text editor to search the occurances of the searched ports across folder and subfolders of \xampp\apache\conf\

Changing port 80
\xampp\apache\conf\httpd.conf

  • Open in your editor \xampp\apache\conf\httpd.conf
  • Search for the following line
    Code: Select all
    Listen 80
    Change to your prefered port (e.g. port 10080)
    Code: Select all
    Listen 10080
  • Search for the following line
    Code: Select all
    ServerName localhost:80
    Change to your prefered port (e.g. port 10080)
    Code: Select all
    ServerName localhost:10080
  • save the file
Changing port 443
\xampp\apache\conf\extra\httpd-ssl.conf

  • Open in your editor \xampp\apache\conf\extra\httpd-ssl.conf
  • Search for the following line
    Code: Select all
    Listen 443
    Change to your prefered port (e.g. port 10443)
    Code: Select all
    Listen 10443
  • Search for the following line
    Code: Select all
    <VirtualHost _default_:443>
    Change to your prefered port (e.g. port 10443)
    Code: Select all
    <VirtualHost _default_:10443>
  • Search for the following line
    Code: Select all
    ServerName www.example.com:443
    Change to your prefered port (e.g. port 10443)
    Code: Select all
    ServerName www.example.com:10443
  • save the file

After changing the Apache configuration files Apache needs to be restartet


XAMPP control panel configuration

  • Start your control panel
  • click on the [Config] Button
  • Click on the [Service and port changes] Button
  • In Apache tab change the Main port and SSL port to the new ports
  • Click [Save] Button twice
  • Restart the XAMPP control panel
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

[Q&A] solving ServerRoot must be a valid directory

Postby Altrea » 11. November 2014 23:21

This is a common issue for installed XAMPP installations on portable devices

Unregister Apache services

Services are drive letter dependend. On portable devices it is not recommend to use Windows Services to start the components, so we need to unregister them if they are registered.
  • Open your XAMPP control panel with elevated administrative rights (rightclick -> run as Administrator)
  • click on the green tick buttons left of each application name
  • Click Yes to uninstall the respective service
    Image

Unbound XAMPP from a drive letter

Unbounding XAMPP from drive letters is not really needed to successfully start Apache. But on portable devices or network shares drive letters could change and the problem reoccures, so it is best practice to not use drive letters.
To unbound drive letters on with portable XAMPP versions, we need to change the setup_xampp.bat file to simulate a portable installation and execute it after that.

  • open your \xampp\setup_xampp.bat file in your editor
  • search for the following line
    Code: Select all
    %PHP_BIN% -n -d output_buffering=0 %CONFIG_PHP%
  • add "usb" at the end of the line
    Code: Select all
    %PHP_BIN% -n -d output_buffering=0 %CONFIG_PHP% usb
  • save the file

Fixing wrong XAMPP base paths

Simply execute the file setup_xampp.bat
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8294
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 41 guests