Hi, After a clean installaton of apache, it started behaving strangely - if I'm starting it using the "httpd" command all is smooth, the error log is clean. If I'm using "service httpd start" it fails to start. I've installed apache using yum. "service httpd stop" works by the way. Did anyone experienced such a thing?? Help would be greatly appreciated. # # service doesn't work, while a direct start does... # [05:31:20][ *root* @ ***:~]$ service httpd restart Stopping httpd: [ OK ] Starting httpd: [FAILED] [05:35:32][ *root* @ ***:~]$ httpd [05:35:36][ *root* @ ***:~]$ tail /var/log/httpd/error_log ... [Wed Aug 15 05:35:32 2007] [notice] caught SIGTERM, shutting down [Wed Aug 15 05:35:36 2007] [notice] SELinux policy enabled; httpd running as context root:system_r:unconfined_t:SystemLow-SystemHigh [Wed Aug 15 05:35:36 2007] [notice] Apache/2.2 configured -- resuming normal operations # # the way I installed httpd # [05:35:51][ *root* @ ***:~]$ history | grep yum ... 150 yum install httpd php mysql mysql-server php-mysql ... * * /etc/sysconfig/network * [06:40:46][ *root* @ ***:~]$ cat /etc/sysconfig/network | grep <domain.com> HOSTNAME=<domain.com> * * /etc/hosts * [06:41:07][ *root* @ ***:~]$ cat /etc/hosts | grep <domain.com> 65.111.161.6 <domain.com> ***
try running "apachectl start" and see if that comes up with the same error as using the service command, also when apache FAILS to start using the service command, what is the error that is throw, and if one isn't throw it might indicate that when using the service command apache doesn't have access to open the error log file.
mmm... apachectl start doesn't start apache, nor does it throw anything error to the log or stdout. This is what's happening when trying service httpd start - a failure and no error either to the log of stdout. when starting apache just by httpd is starts smooth though :-? is there any log for the service command? maybe i can find something there. # # stoping apache, and this is the last message on the error log # [23:54:43][ *root* @ ***:~]$ service httpd stop Stopping httpd: [ OK ] # # service httpd start output (fails) # [00:09:22][ *root* @ ***:~]$ service httpd start Starting httpd: [FAILED] [00:09:29][ *root* @ ***:~]$ tail /var/log/httpd/error_log ... [Wed Aug 15 23:54:49 2007] [notice] caught SIGTERM, shutting down # # apachectl start output (fails) # [00:12:50][ *root* @ ***:~]$ apachectl start [00:12:59][ *root* @ ***:~]$ tail /var/log/httpd/error_log ... [Wed Aug 15 23:54:49 2007] [notice] caught SIGTERM, shutting down # # httpd start success # [00:13:06][ *root* @ ***:~]$ httpd [00:15:23][ *root* @ ***:~]$ tail /var/log/httpd/error_log ... [Wed Aug 15 23:54:49 2007] [notice] caught SIGTERM, shutting down [Thu Aug 16 00:15:23 2007] [notice] SELinux policy enabled; httpd running as context root:system_r:unconfined_t:SystemLow-SystemHigh [Thu Aug 16 00:15:23 2007] [notice] Apache/2.2 configured -- resuming normal operations
one of the main reasons apache fails silently is no access to the log files (esp error) try chmod'n the error log file 777 and see what happens you can also do "strace apachectl start" and see what is happening you have selinux installed as well - that might have something to do with it, i don't have much experience with selinux so am unsure on that one.
Hi Grunt, Thanks a lot for your help! Didn't even think on starce :-|, great idea. Anyway, Was checking the chmod thing and no help, though apache might be able to access the log on 777 when selinux is on... (damn thing, never understand why you need more than the regular access levels) # # after chmoding # [10:39:50][ *root* @ ***:/var/log]$ chmod -R 777 httpd [10:40:03][ *root* @ ***:/var/log]$ service httpd stop Stopping httpd: [ OK ] [10:40:13][ *root* @ ***:/var/log]$ service httpd start Starting httpd: [FAILED] # #Couldn't find anything on the strace (/sbin/env and /usr/sbin/env are missing, but /bin/env is found and accesible). #Do you see something? # rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 access("/etc/init.d/httpd", X_OK) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 stat(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 stat("/sbin/env", 0x7fff051c43b0) = -1 ENOENT (No such file or directory) stat("/usr/sbin/env", 0x7fff051c43b0) = -1 ENOENT (No such file or directory) stat("/bin/env", {st_mode=S_IFREG|0755, st_size=20816, ...}) = 0 access("/bin/env", X_OK) = 0 access("/bin/env", R_OK) = 0 stat("/bin/env", {st_mode=S_IFREG|0755, st_size=20816, ...}) = 0 access("/bin/env", X_OK) = 0 access("/bin/env", R_OK) = 0 rt_sigprocmask(SIG_BLOCK, [INT CHLD], [], 8) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [INT CHLD], 8) = 0 rt_sigprocmask(SIG_SETMASK, [INT CHLD], NULL, 8) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x2aaaaaab6e40) = 20229 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 rt_sigaction(SIGINT, {0x435ec0, [], SA_RESTORER, 0x398b630070}, {SIG_DFL}, 8) = 0 wait4(-1, Starting httpd: [FAILED] [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 20229 rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 --- SIGCHLD (Child exited) @ 0 (0) --- wait4(-1, 0x7fff051c4294, WNOHANG, NULL) = -1 ECHILD (No child processes) rt_sigreturn(0xffffffffffffffff) = 0 rt_sigaction(SIGINT, {SIG_DFL}, {0x435ec0, [], SA_RESTORER, 0x398b630070}, 8) = 0 rt_sigprocmask(SIG_BLOCK, NULL, [], 8) = 0 read(255, "", 1744) = 0 exit_group(1) = ? Process 20222 detached
It's the damn selinux thing. I'll chek it further and let you know what was it ;-) If you have any idea (so far you're right on), I'm all ears ;-) [10:48:01][ *root* @ ***:/var/log]$ echo 0 >/selinux/enforce [11:02:32][ *root* @ ***:/var/log]$ service httpd start Starting httpd: [ OK ] [11:02:39][ *root* @ ***:/var/log]$ service httpd stop Stopping httpd: [ OK ] [11:02:45][ *root* @ ***:/var/log]$ echo 1 >/selinux/enforce [11:02:53][ *root* @ ***:/var/log]$ service httpd start Starting httpd: [FAILED]
i know selinux you have to add stuff into it, i think there's a program that does it for you. starting httpd directly is poissbley working because it's already been added. however starting it via service or apachectl is going though a child process, i am unsure on what needs to be done about it thou