Click to See Complete Forum and Search --> : which apache is running?


phpsharma
07-26-2006, 08:07 AM
Hi all,

My server is stopped all of sudden. I tried to start it. I am unable to start it as it have 2 instances of apache. Now my problem is to find the correct instance to start..


I tried "/etc/rc.d/init.d/httpd restart" its giving message its started but not working..

please help me to find out the correct instance..

when i locate for httpd.conf it returns these....But i have found 2 httpd.conf files in it.

/usr/local/apache/conf/httpd.conf.bak-rb
/usr/local/apache/conf/httpd.conf
/usr/local/apache/conf/httpd.conf.default
/usr/local/apache/conf/httpd.conf.bak
/etc/yum.repos.d/apache_1.3.33/conf/httpd.conf-dist-nw
/etc/yum.repos.d/apache_1.3.33/conf/httpd.conf-dist
/etc/yum.repos.d/apache_1.3.33/conf/httpd.conf-dist-win
/etc/httpd/conf/httpd.conf

Thanks in advance,
sharma

tsinka
07-26-2006, 08:16 AM
Hi,

which of the two httpd.conf files is newer ? Locate the log files and check which logfiles are newer.

If the /usr/local/apache installation is newer then try to execute:

/usr/local/apache/bin/apachectl start


Thomas

phpsharma
07-26-2006, 08:48 AM
Hi Thomas,

Thanks for your info.

My apache log is shwoing latest..

[root@tw1 sbin]# tail -f /usr/local/apache/logs/error_log
[Tue Jul 25 12:33:37 2006] [error] [client 221.134.247.187] File does not exist: /var/www/html/back.gif
[Tue Jul 25 12:33:43 2006] [error] [client 70.58.106.32] File does not exist: /var/www/html/images/single.png
[Tue Jul 25 12:33:43 2006] [error] [client 70.58.106.32] File does not exist: /var/www/html/favicon.ico
[Tue Jul 25 12:33:49 2006] [error] [client 221.134.247.187] File does not exist: /var/www/html/theo/
[Tue Jul 25 12:34:19 2006] [error] [client 70.58.106.32] File does not exist: /var/www/html/theo/
[Tue Jul 25 13:36:57 2006] [error] [client 221.134.247.187] File does not exist: /var/www/html/images/single.png
[Tue Jul 25 13:37:06 2006] [error] [client 221.134.247.187] File does not exist: /var/www/html/blank.gif
[Tue Jul 25 13:37:06 2006] [error] [client 221.134.247.187] File does not exist: /var/www/html/unknown.gif
[Tue Jul 25 13:37:06 2006] [error] [client 221.134.247.187] File does not exist: /var/www/html/back.gif
[Tue Jul 25 13:38:45 2006] [notice] caught SIGTERM, shutting down

Can you please guide me to solve this.

Sharma

phpsharma
07-26-2006, 08:50 AM
i run this command ..error was this...

[root@tw1 sbin]# /usr/sbin/apachectl status
Not Found

The requested URL /server-status was not found on this server.

---------------------------------------------------------------------------

Apache/2.0.52 (CentOS) Server at localhost Port 80
[root@tw1 sbin]#

tsinka
07-26-2006, 09:01 AM
Ok,

"caught SIGTERM, shutting down" means that apache got a SIGTERM signal and stopped. Looks like the apache server has been shut down using the control script.

The server-status message means that the server-status url is not set up in httpd.conf. Normally, that's nothing to worry about.

Did you start apache with /usr/local/apache/bin/apachectl start ?


Thomas

phpsharma
07-26-2006, 09:06 AM
Thomas,STILL not working..
[root@tw1 sbin]# /usr/sbin/apachectl status
Not Found

The requested URL /server-status was not found on this server.

---------------------------------------------------------------------------

Apache/2.0.52 (CentOS) Server at localhost Port 80
[root@tw1 sbin]# /usr/sbin/apachectl start
httpd (pid 8910) already running
[root@tw1 sbin]# /usr/sbin/apachectl stop
[root@tw1 sbin]# /usr/sbin/apachectl start

phpsharma
07-26-2006, 09:11 AM
I have run the command not working.. but not working

tsinka
07-26-2006, 09:58 AM
Ok,

httpd (pid 8910) already running means that the apache server is already running. Do you get a timeout if you try to request a page or some error message ?

How do the last lines of the error_log look like after stopping and starting the apache ? the status command does not work with your apache setup so it will fail no matter if apache is running or not.

In order to enable the status handler you need to activate the module mod_status and to add the following configuration directive:

<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

You may need to change 127.0.0.1 or temporarily remove the Deny from all line and change the allow line to
Allow from all

Thomas

phpsharma
07-26-2006, 12:04 PM
Thomas,

Thanks for your inputs so far, I tired the alternatives ..but not solved yet.. I will repost the developements.

Thanks,
sharma

tsinka
07-26-2006, 02:39 PM
Please check if the httpd process is running at all after starting it. First, check the error log, it should contain a notice about the successful start of apache. Besides that check if you can find running httpd processes (using the "ps" command).

Which error do you get if you try to request a page with your browser ?

phpsharma
07-27-2006, 09:36 AM
Thomas,

I found that there are two apaches installed on the system. The exact php and configurations are running with 1.33. when i try to start the httpd by command

/etc/rc.d/init.d/httpd start

It is starting 2.X and not 1.33

This is the main reason for the site down..

Thomas, Now can you tell me how to stop and start 1.33.

Thanks for all your guidelines..

Sharma

tsinka
07-27-2006, 11:51 AM
Execute the command

/usr/loca/apache/bin/httpd -v

to get the version. Additionally check if there are other httpd or httpd2 binaries and execute them with <binary> -v to get the versions.

Please post the /etc/init.d/httpd init script.

Thomas

phpsharma
07-27-2006, 12:09 PM
#!/bin/bash
#
# httpd Startup script for the Apache HTTP Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# config: /etc/httpd/conf/httpd.conf
# config: /etc/sysconfig/httpd
# pidfile: /var/run/httpd.pid

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/httpd ]; then
. /etc/sysconfig/httpd
fi

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/sbin/apachectl
httpd=${HTTPD-/usr/sbin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/httpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/httpd}
RETVAL=0

# check for 1.3 configuration
check13 () {
CONFFILE=/etc/httpd/conf/httpd.conf
GONE="(ServerType|BindAddress|Port|AddModule|ClearModuleList|"
GONE="${GONE}AgentLog|RefererLog|RefererIgnore|FancyIndexing|"
GONE="${GONE}AccessConfig|ResourceConfig)"
if LANG=C grep -Eiq "^[[:space:]]*($GONE)" $CONFFILE; then
echo
echo 1>&2 " Apache 1.3 configuration directives found"
echo 1>&2 " please read /usr/share/doc/httpd-2.0.52/migration.html"
failure "Apache 1.3 config directives test"
echo
exit 1
fi
}

# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
check13 || exit 1
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc $httpd -HUP
RETVAL=$?
fi
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL

phpsharma
07-27-2006, 12:22 PM
Thomas,

Just started apache ..with

/etc/rc.d/init.d/httpd start



[root@tw1 conf]# /usr/local/apache/bin/httpd -v
-bash: /usr/local/apache/bin/httpd: No such file or directory


Tried:/usr/sbin/httpd -v

[root@tw1 conf]# /usr/sbin/httpd -v
Server version: Apache/2.0.52
Server built: Jan 5 2006 12:31:31
[root@tw1 conf]#

tsinka
07-27-2006, 12:41 PM
Could also be /usr/local/apache/sbin/httpd or /usr/local/apache/libexec/httpd. That depends on how apache has been compiled.

execute the command:

find /usr/local/apache -regex "^.*httpd2?$"

To find all httpd executables:

find / -regex "^.*httpd2?$"


Thomas

phpsharma
07-27-2006, 12:47 PM
Thomas,

1st command no resluts..


[root@tw1 conf]# find /usr/local/apache -regex "^.*httpd2?$"
[root@tw1 conf]#


2nd command


[root@tw1 conf]# find / -regex "^.*httpd2?$"

/root/php-5.0.5/php-5.0.5/sapi/thttpd
/root/php-5.0.5/php-5.0.5/sapi/phttpd
/root/php-5.0.5/sapi/thttpd
/root/php-5.0.5/sapi/phttpd
/root/apache_1.3.33/src/httpd
/usr/lib/httpd
/usr/sbin/httpd
/var/lock/subsys/httpd
/var/log/httpd
/etc/yum.repos.d/php-5.0.5/sapi/thttpd
/etc/yum.repos.d/php-5.0.5/sapi/phttpd
/etc/yum.repos.d/apache_1.3.33/src/httpd
/etc/rc.d/init.d/httpd
/etc/rc.d/rc3.d/S85httpd
/etc/rc.d/rc5.d/S85httpd
/etc/rc.d/rc6.d/K15httpd
/etc/rc.d/rc0.d/K15httpd
/etc/rc.d/rc4.d/S85httpd
/etc/rc.d/rc2.d/S85httpd
/etc/rc.d/rc1.d/K15httpd
/etc/logrotate.d/httpd
/etc/httpd
/etc/sysconfig/httpd
/home/sharma/july2006/httpd

tsinka
07-27-2006, 12:54 PM
Please post the output of

ll /usr/local/apache/bin

(check if there are directories like sbin or libexec in /usr/local/apache and post the contents).

Modify the command I posted a little bit:

find / -type f -regex "^.*httpd2?$"

I just want to get regular files (no directories).

What's in /home/sharma/july2006/httpd and check if there's a file named config.log in /root/apache_1.3.33/... or in /etc/yum.repos.d/apache_1.3.33/....


Thomas

phpsharma
07-27-2006, 01:19 PM
Tthere is no bin directory in /usr/local/apache/

1) out put of /usr/local/apache/

[root@tw1 apache]# ls
cgi-bin conf htdocs icons include index.htm libexec logs man proxy
[root@tw1 apache]# pwd
/usr/local/apache
[root@tw1 apache]#


2) running command find / -type f -regex "^.*httpd2?$"

[root@tw1 apache]# find / -type f -regex "^.*httpd2?$"
/root/apache_1.3.33/src/httpd
/usr/sbin/httpd
/var/lock/subsys/httpd
/etc/yum.repos.d/apache_1.3.33/src/httpd
/etc/rc.d/init.d/httpd
/etc/logrotate.d/httpd
/etc/sysconfig/httpd
/home/sharma/july2006/httpd
[root@tw1 apache]#



3) in /home/sharma/july2006/httpd

This file I have copied to local ystem to paste into browser. the contents are same as the previous post of httpd.

4) config.log

[root@tw1 apache_1.3.33]# locate config.log
/root/mod_ssl-2.8.24-1.3.33/etc/patch/config.log
/root/mhash-0.9.2/config.log
/root/php-5.0.5/config.log
/usr/local/bin/ruby-1.8.2/config.log
/etc/yum.repos.d/php-5.0.5/config.log
[root@tw1 apache_1.3.33]#


Thanks for your time

tsinka
07-27-2006, 04:36 PM
Please post the files /root/php-5.0.5/config.log and /root/mod_ssl-2.8.24-1.3.33/etc/patch/config.log as attachment (in a zip file).
Is there a config.log file in /root/apache_1.3.33/ or in /root/apache_1.3.33/src/ ?

Thomas

phpsharma
07-27-2006, 05:08 PM
no log files in that dirs. I am trying to send in the files requseted.

I would like to uninstall all and a new install wil solve all my issues

Thanks a lot Thomas. I am going to bed . its 2 am here.. :mad: