gustavmaskowitz / apachebuddy.pl

Not written by me, no longer maintained by me : Apachebuddy.pl
97 stars 59 forks source link

"Could not find Apache process. Exiting..." #17

Open stephen304 opened 10 years ago

stephen304 commented 10 years ago

I have apache2 installed via apt-get on ubuntu 13.10 x64. Here is the output of apachebuddy:

########################################################################
# Apache Buddy v 0.3 ###################################################
########################################################################
Gathering information...
We are checking the service running on port 80
The process listening on port 80 is /usr/sbin/apache2
The process running on port 80 is not Apache. 
 Falling back to process list...
Could not find Apache process. Exiting...

So you can see it finds apache2, but it somehow doesn't think it's apache...

JordanMagnuson commented 10 years ago

I'm running Apache2 behind Varnish, and no luck...

Apache Buddy v 0.3 Gathering information... We are checking the service running on port 80 The process listening on port 80 is /usr/sbin/varnishd The process running on port 80 is not Apache. Falling back to process list... Could not find Apache process. Exiting...

JordanMagnuson commented 10 years ago

Easy fix in my case:

perl apachebuddy.pl --port=8080

stephen304 commented 10 years ago

The problem for me is that apahe is running on port 80, not 8080... yet apachebuddy still won't recognize it.

willtate commented 10 years ago

I'm seeing the same issue as @Stephen304. I initially installed via Ubuntu 13.10 but recently upgraded to 14.04 LTS.

output:

########################################################################
# Apache Buddy v 0.3 ###################################################
########################################################################
Gathering information...
We are checking the service running on port 80
The process listening on port 80 is /usr/sbin/apache2
The process running on port 80 is not Apache. 
 Falling back to process list...
Could not find Apache process. Exiting...
draiocht commented 10 years ago

Same output as willtate Ubuntu 14.04 LTS Server 64bit Clean install on 14.04, basic apache install, no varnish $apache2 -v Server version: Apache/2.4.7 (Ubuntu) Server built: Apr 3 2014 12:20:28

draiocht commented 10 years ago

Same output as willtate Ubuntu 14.04 LTS Server 64bit Clean install on 14.04, basic apache install, no varnish $apache2 -v Server version: Apache/2.4.7 (Ubuntu) Server built: Apr 3 2014 12:20:28

CAUSE : CAPITAL V unnecessary for the purpose of the function to ID apache. On my system it invokes sudo /usr/sbin/apache2 -V which outputs nonsense only, no versions. sudo /usr/sbin/apache2 -v just gives a version without a mile of complaints first which throw perl off as it looks for the id in the first line of output only.

SOLUTION TO JUST THIS STEP - which basically only hides the underlying problem so apachebuddy does recognise it is apache. CHANGE my @output = $process_name -V 2>&1; to my @output = $process_name -v 2>&1;

that got me past that issue - but onwards into other ones..... Ubuntu really changed about a lot of apache structural stuff with 14.04. Paths, splitting up configs etc. mucho broken :/ /usr/sbin/apache2 cant really be invoked in this way. for more info, see the default index.html file on a fresh install of 14.04, it talks a lot about what changed and is unusually informative.

draiocht commented 10 years ago

Rename issue to compatibility with Ubuntu 14.04 LTS apache2

BillyGriffiths commented 10 years ago

Experience same issue on 14.04 LTS. Anyone have a workaround for this yet?

########################################################################

Apache Buddy v 0.3

######################################################################## Gathering information... We are checking the service running on port 80 The process listening on port 80 is /usr/sbin/apache2 The process running on port 80 is not Apache. Falling back to process list... Could not find Apache process. Exiting...

kfo2010 commented 10 years ago

Experience same issue on 14.04 LTS w/ Apache 2.4. States constants set by envvars do not exist or the script can't read them when loading /etc/apache2/apache2.conf.

AH00526: Syntax error on line 76 of /etc/apache2/apache2.conf: Invalid Mutex directory in argument file:${APACHE_LOCK_DIR} [Thu Nov 13 16:23:06.209479 2014] [core:warn] [pid 5640] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined [Thu Nov 13 16:23:06.209798 2014] [core:warn] [pid 5640] AH00111: Config variable ${APACHE_PID_FILE} is not defined [Thu Nov 13 16:23:06.209922 2014] [core:warn] [pid 5640] AH00111: Config variable ${APACHE_RUN_USER} is not defined [Thu Nov 13 16:23:06.210032 2014] [core:warn] [pid 5640] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined [Thu Nov 13 16:23:06.210151 2014] [core:warn] [pid 5640] AH00111: Config variable ${APACHE_LOG_DIR} is not defined [Thu Nov 13 16:23:06.232641 2014] [core:warn] [pid 5640] AH00111: Config variable ${APACHE_LOG_DIR} is not defined

xn commented 9 years ago

22 addresses the issue. Long story short running apache2 does not load the env vars, however apache2ctl does. I tweaked a regex to deal with the different format for the compiled modules. I'm pretty sure this solution will not work for everyone, so I wouldn't merge as is unless someone else really puts it through its paces.

manuelsdt commented 9 years ago

I've got the same issue on 14.04 (14.04.1 LTS codename trusty) running apache2. I don't really understand how to try the fix above (#22), can anyone explain?

root@www:/home/manuel# ./apachebuddy.pl ########################################################################

Apache Buddy v 0.3

######################################################################## Gathering information... We are checking the service running on port 80 The process listening on port 80 is /usr/sbin/apache2 The process running on port 80 is not Apache. Falling back to process list... Could not find Apache process. Exiting...

xn commented 9 years ago

You can just yank the code from my fork: https://github.com/xn/apachebuddy.pl

manuelsdt commented 9 years ago

xn, thanks a lot, didn't realize it was that simple, this is my first use of github. This worked flawlessly for me.

xn commented 9 years ago

No worries. Great to hear. Open source for the win!

manuelsdt commented 9 years ago

I missed something the first time around. I'm still getting this:

"Unsuccessful stat on filename containing newline at ./apachebuddy.pl line 125 (#1) (W newline) A file operation was attempted on a filename, and that operation failed, PROBABLY because the filename contained a newline, PROBABLY because you forgot to chomp() it off. See "chomp" in perlfunc."

Does this matter or something to just ignore?

xn commented 9 years ago

I just updated my fork, you can try that.

manuelsdt commented 9 years ago

Beautiful. Works perfect without any errors now! Thanks so much!

davidak commented 9 years ago

I have also the problem on 14.04 LTS with a Plesk install (Apache behind Nginx). Also the fork don't work for me.

# ./apachebuddy.pl -p 7080
########################################################################
# Apache Buddy v 0.3 ###################################################
########################################################################
Gathering information...
We are checking the service running on port 7080
The process listening on port 7080 is /usr/sbin/apache2
The process running on port 7080 is not Apache. 
 Falling back to process list...
Could not find Apache process. Exiting...
xn commented 9 years ago

What is the process running under?

xn commented 9 years ago

you can run this to see if you get the correct pid: ps aux | grep -v grep | egrep '^root.*(httpd|apache2)' | awk 'BEGIN {ORS=""} {print $2}'

xn commented 9 years ago

if it does, you can edit this line: https://github.com/xn/apachebuddy.pl/blob/master/apachebuddy.pl#L974 to:

$pid =ps aux | grep -v grep | egrep \'^root.*(httpd|apache2)\' | awk \'BEGIN {ORS=\"\"} {print \$2}\' ;

billynoah commented 9 years ago

I am under the impression that Apache 2.4+ doesn't even use the MaxClients directive which has been replaced by MaxRequestWorkers. Presumably there are other changes as well which would require a more thorough examination of this script and it's recommendations.

ksashikumar commented 8 years ago

This worked for me: curl -sL apache2buddy.pl | perl

hrazouk commented 7 years ago

Hello when do curl -sL apache2buddy.pl | perl I receive curl -sL apache2buddy.pl | perl Please help

hrazouk commented 7 years ago

sorry I receive There are multiple PIDs listening on port 80

fedya commented 7 years ago

`root@old:~# perl apachebuddy.pl

########################################################################
# Apache Buddy v 0.3 ###################################################
########################################################################
Gathering information...
We are checking the service running on port 80
The process listening on port 80 is /usr/sbin/apache2
The process running on port 80 is not Apache. 
 Falling back to process list...
Could not find Apache process. Exiting...
AmirHome commented 5 years ago

curl -sL apachebuddy.pl | perl

########################################################################

Apache Buddy v 0.3

######################################################################## Gathering information... We are checking the service running on port 80 The process listening on port 80 is /usr/sbin/apache2 The process running on port 80 is not Apache. Falling back to process list... Could not find Apache process. Exiting...