Aww, take a deep breath and remember that things fail on all systems,
and, if you've messed up httpd.conf, apache will fail starting on every
system, linuxes, unixes and freebsds alike.

The skill is in how to find why it failed, and how to rectify the
system. This is where OpenSolaris's service control system tries to
actually help you, but it's easier to do it from terminal.

Here's a possible and hopefully useful example walkthrough for the
diagnostics of apache22 with messed up httpd.conf:

Let's check the server messages, there can be something interesting
sometimes. dmesg is the thing that works on virtually any *nix system,
and shows the messages from the system error log:

~ % dmesg
...
Aug 21 18:01:03 sunshine svc.startd[7]: [ID 748625 daemon.error]
network/http:apache22 failed fatally: transitioned to maintenance (see
'svcs -xv' for details)

svcs -xv will tell the information about failed solaris' services, so
let's do as it suggests:

~ % svcs -xv
svc:/network/http:apache22 (Apache 2.2 HTTP server)
 State: maintenance since Fri Aug 21 18:01:03 2009
Reason: Start method exited with $SMF_EXIT_ERR_FATAL.
   See: http://sun.com/msg/SMF-8000-KS
   See: man -M /usr/apache2/2.2/man -s 8 httpd
   See: http://httpd.apache.org
   See: /var/svc/log/network-http:apache22.log
Impact: This service is not running.

Aha, bunch of additional information. The sun.com link says nothing too
relevant ? just blabs about the fact that start method failed. The
logfile mentioned, though, is a different thing:

~ % tail /var/svc/log/network-http:apache22.log
Apache version is 2.2
Syntax error on line 402 of /etc/apache2/2.2/httpd.conf:
Invalid command 'Asdfg', perhaps misspelled or defined by a module not
included in the server configuration 
Server failed to start. Check the error log (defaults
to /var/apache2/2.2/logs/error_log) for more information, if any. 
[ Aug 21 18:01:03 Method "start" exited with status 95. ]

Aha! Somebody added a line "Asdfg" to the httpd.conf!
Let's edit it out
 ~ % pfexec vim /etc/apache2/2.2/httpd.conf

... and tell svcadm that apache is probably good again...

~ % svcadm disable apache22 
~ % svcadm enable apache22

~ % svcs -x apache22                      
svc:/network/http:apache22 (Apache 2.2 HTTP server)
 State: online since Fri Aug 21 18:02:26 2009
   See: httpd(8)
   See: http://httpd.apache.org
   See: /var/svc/log/network-http:apache22.log
Impact: None.

Voil?, problem hopefully solved. If not ? then check the logs again,
rinse, repeat.

> Unless someone can help me out here, the only option I
> can really see is to reinstall the entire Operating System

Reinstalling is nothing to fear, though failing service is a bit too
little for a reason. Just keep the backups handy :)

Hope this helps :)

Cheers, 

Einar


Reply via email to