Why doesn't Apache start? [Solved]

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

Why doesn't Apache start? [Solved]

Postby Grafica » 24. July 2012 23:57

I'm running xampp with Windows 7, Control Panel v3.0.11, and want to host multiple sites, so I changed the httpd-vhosts.conf file. Is there something wrong with my code? Apache was running while I had only one site in the config, but after I added another site, I stopped Apache, and I'm not able to restart it. MySQL is running on port 3306, but control panel says, "Starting apache service..." and never starts. The "Apache" is not highlighted in green.

Code: Select all
#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host.localhost
    ##DocumentRoot "C:/xampp/htdocs/dummy-host.localhost"
    ##ServerName dummy-host.localhost
    ##ServerAlias www.dummy-host.localhost
    ##ErrorLog "logs/dummy-host.localhost-error.log"
    ##CustomLog "logs/dummy-host.localhost-access.log" combined
##</VirtualHost>

##<VirtualHost *:80>
    ##ServerAdmin postmaster@dummy-host2.localhost
    ##DocumentRoot "C:/xampp/htdocs/dummy-host2.localhost"
    ##ServerName dummy-host2.localhost
    ##ServerAlias www.dummy-host2.localhost
    ##ErrorLog "logs/dummy-host2.localhost-error.log"
    ##CustomLog "logs/dummy-host2.localhost-access.log" combined
##</VirtualHost>

NameVirtualHost *:80
  <VirtualHost *>
    DocumentRoot "C:\xampp\htdocs"
    ServerName localhost
  </VirtualHost>
 
  <VirtualHost *>
    DocumentRoot "C:\xampp\htdocs"
    ServerName evamagnus.com
  <Directory "C:\xampp\htdocs\">
    Order allow,deny
    Allow from all
  </Directory>
  </VirtualHost>
 
  <VirtualHost *>
    DocumentRoot "C:\xampp\htdocs2\"
    ServerName mygrafica.com
    <Directory "C:\xampp\htdocs2\">
    Order allow,deny
    Allow from all
  </Directory>
  </VirtualHost>


Thanks.
Grafica
 
Posts: 12
Joined: 08. February 2012 23:03
Operating System: Windows 7 SP1, 32 bit

Re: Why doesn't Apache start?

Postby hackattack142 » 25. July 2012 01:30

I have never setup Virtual Hosts before but here are my guesses:

My first guess would be if you want a wildcard, you need <VirtualHost *:*> instead of <VirtualHost *>

If that is not it, every example I have seen does not mention anything about putting the <Directory>..</Directory> inside of a virtual host declaration.

You also have NameVirtualHost *:80 twice in that file but not sure if that would affect anything.
XAMPP Control Panel Developer
Latest CP: viewtopic.php?f=16&t=48932
hackattack142
 
Posts: 703
Joined: 20. May 2011 23:29
Operating System: Windows 7 Ultimate SP1 64-Bit

Re: Why doesn't Apache start?

Postby Altrea » 25. July 2012 05:17

Hi Grafica,

Grafica wrote:Is there something wrong with my code?

There are some things that should be corrected. But at the end your vhost definitions are not the reason why your Apache is not starting (because on my testmachine XAMPP is starting with exactly the same definitions).
  • There should be only one NameVirtualHost per ip/port. Multiple NameVirtualHost lines will not have any negative sideeffects, but to be clean there should only be one. With Apache 2.4 (included in XAMPP 1.8.0) there is no more need to use the NameVirtualHost line at all. It is deprecated and will be released in the next minor release.
  • Your <VirtualHost> lines should have a specific port definition. very common <VirtualHost *:80> is used. Otherwise you will get Apache warnings like "[warn] NameVirtualHost *:80 has no VirtualHosts" if they are not matching your NameVirtualHost lines
  • Defining <Directory> Blocks inside your <VirtualHost> Blocks is only necessary if they are not defined anywhere else. For example if you haven't change the default <Directory> Block in httpd.conf, the <Directory "C:\xampp\htdocs\"> definition in your vhost file is a duplicate.
  • If you are using XAMPP 1.8.0 you should replace your access definitions.
    Instead of
    Code: Select all
    Order allow,deny
        Allow from all
    you should know use
    Code: Select all
    Require all granted

Grafica wrote:but control panel says, "Starting apache service..." and never starts. The "Apache" is not highlighted in green.

If the service is not running, unregister it and try to start Apache without that service.
If this will not help, take a look into your \xampp\apache\logs\error.log file. Apache should report in that file why it can't start.

Grafica wrote:I'm running xampp with Windows 7, Control Panel v3.0.11

  • In your profile you wrote that you are using XAMPP 1.8.0, but the current XAMPP version is shipped with XAMPP control panel v3.0.12!?
  • "Windows 7" is not specific enough. There are several Windows 7 versions out there from Windows 7 Starter 32bit up to Windows 7 Enterprise 64 Bit and some other versions like Windows 7 Embedded. Please be much more specific. Relevant is the exact product name and if it is installed as 32bit or 64bit.

best wishes,
Altrea
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: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Why doesn't Apache start?

Postby Grafica » 25. July 2012 17:22

I updated entries in my profile for OS and xampp version. I'm running Windows 7 Professional SP1, 32 bit OS, and I checked on the xampp version, and it's actually 1.7.7. I downloaded Conrol Panel v3.0.11 yesterday through a link from Sharla's footer, since an upgarde was recommended.

How do I unregister Apache service?
Thanks.
Grafica
 
Posts: 12
Joined: 08. February 2012 23:03
Operating System: Windows 7 SP1, 32 bit

Re: Why doesn't Apache start?

Postby Grafica » 25. July 2012 22:28

I updated my profile again, because I uninstalled xampp, downloaded version 1.8.0 and installed it. Apache started after that, but after I changed the vhosts file, I stopped it, and wanted to restart it, but it did not. Now I'm using Control Panel v3.0.12.

This is what I have now in the vhosts file:

Code: Select all
<VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs"
        ServerName evamagnus.com
</VirtualHost>
     
      <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs2\"
        ServerName mygrafica.com
      <Directory "C:\xampp\htdocs2\">
        Require all granted
      </Directory>
      </VirtualHost>


Again, Apache is not starting.
Grafica
 
Posts: 12
Joined: 08. February 2012 23:03
Operating System: Windows 7 SP1, 32 bit

Re: Why doesn't Apache start?

Postby JonB » 25. July 2012 22:52

As Altrea suggested - looking in the Apache error log is the key.

Did Apache start when you first installed XAMPP???

If there is no error log - then you have an OS related problem stopping Apache from starting

If there is an error log, Apache will very likely tell us what It did not like...

\xampp\apache\logs\error.log

You can also do a configuration file check using the Command Window

Code: Select all
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\JonB>cd \xampp\apache\bin

C:\xampp\apache\bin>httpd.exe /?
Usage: httpd.exe [-D name] [-d directory] [-f file]
                 [-C "directive"] [-c "directive"]
                 [-w] [-k start|restart|stop|shutdown] [-n service_name]
                 [-k install|config|uninstall] [-n service_name]
                 [-v] [-V] [-h] [-l] [-L] [-t] [-T] [-S] [-X]
Options:
  -D name            : define a name for use in <IfDefine name> directives
  -d directory       : specify an alternate initial ServerRoot
  -f file            : specify an alternate ServerConfigFile
  -C "directive"     : process directive before reading config files
  -c "directive"     : process directive after reading config files
  -n name            : set service name and use its ServerConfigFile and ServerR
oot
  -k start           : tell Apache to start
  -k restart         : tell running Apache to do a graceful restart
  -k stop|shutdown   : tell running Apache to shutdown
  -k install         : install an Apache service
  -k config          : change startup Options of an Apache service
  -k uninstall       : uninstall an Apache service
  -w                 : hold open the console window on error
  -e level           : show startup errors of level (see LogLevel)
  -E file            : log startup errors to file
  -v                 : show version number
  -V                 : show compile settings
  -h                 : list available command line options (this page)
  -l                 : list compiled in modules
  -L                 : list available configuration directives
  -t -D DUMP_VHOSTS  : show parsed vhost settings
  -t -D DUMP_RUN_CFG : show parsed run settings
  -S                 : a synonym for -t -D DUMP_VHOSTS -D DUMP_RUN_CFG
  -t -D DUMP_MODULES : show all loaded modules
  -M                 : a synonym for -t -D DUMP_MODULES
  -t                 : run syntax check for config files
  -T                 : start without DocumentRoot(s) check
  -X                 : debug mode (only one worker, do not detach)

C:\xampp\apache\bin>httpd.exe -t
Syntax OK

C:\xampp\apache\bin>


The -t will check the configuration files even if Apache is not running OR it will error in the Command Window from teh OS problem

Good Luck
8)




ysf
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Why doesn't Apache start?

Postby Grafica » 25. July 2012 23:15

The error log didn't show anything when I attempt to start Apache. These are previous statements:

Code: Select all
[Wed Jul 25 12:29:52.651445 2012] [ssl:warn] [pid 4996:tid 336] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 25 12:29:52.761445 2012] [mpm_winnt:notice] [pid 4996:tid 336] AH00455: Apache/2.4.2 (Win32) OpenSSL/1.0.1c PHP/5.4.4 configured -- resuming normal operations
[Wed Jul 25 12:29:52.761445 2012] [mpm_winnt:notice] [pid 4996:tid 336] AH00456: Server built: May 13 2012 14:10:15
[Wed Jul 25 12:29:52.761445 2012] [core:notice] [pid 4996:tid 336] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Wed Jul 25 12:29:52.761445 2012] [mpm_winnt:notice] [pid 4996:tid 336] AH00418: Parent: Created child process 4824
[Wed Jul 25 12:29:54.773449 2012] [ssl:warn] [pid 4824:tid 236] AH01873: Init: Session Cache is not configured [hint: SSLSessionCache]
[Wed Jul 25 12:29:54.843449 2012] [mpm_winnt:notice] [pid 4824:tid 236] AH00354: Child: Starting 150 worker threads.
[Wed Jul 25 16:11:52.126441 2012] [mpm_winnt:notice] [pid 4996:tid 336] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Wed Jul 25 16:11:54.136448 2012] [mpm_winnt:notice] [pid 4824:tid 236] AH00364: Child: All worker threads have exited.
[Wed Jul 25 16:11:54.186449 2012] [mpm_winnt:notice] [pid 4996:tid 336] AH00430: Parent: Child process exited successfully.


Also, I ran xampp_start.exe, and it said I had an error on line 51 of the vhosts file, that DocumentRoot must be a directory. On line 51, I have:

Code: Select all
DocumentRoot "C:\xampp\htdocs2\"
Grafica
 
Posts: 12
Joined: 08. February 2012 23:03
Operating System: Windows 7 SP1, 32 bit

Re: Why doesn't Apache start?

Postby Grafica » 25. July 2012 23:16

Oh, and yes, Apache did start after I first installed it.
Grafica
 
Posts: 12
Joined: 08. February 2012 23:03
Operating System: Windows 7 SP1, 32 bit

Re: Why doesn't Apache start?

Postby JonB » 25. July 2012 23:49

try lopping off the trailing backslash '\'. in your references to htdocs2
Code: Select all
      <VirtualHost *:80>
        DocumentRoot "C:\xampp\htdocs2"
        ServerName mygrafica.com
      <Directory "C:\xampp\htdocs2">


I think that will fix issue (at least for syntax errors)

Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Why doesn't Apache start?

Postby Grafica » 26. July 2012 00:03

Oh, wow, Apache is running now for some reason. Thanks for your help.
Grafica
 
Posts: 12
Joined: 08. February 2012 23:03
Operating System: Windows 7 SP1, 32 bit


Return to XAMPP for Windows

Who is online

Users browsing this forum: Gharas and 62 guests