Monday, December 10, 2007

Starting httpd: execvp: No such file or directory [FAILED]

I downloaded the source for the latest Apache HTTP and installed it

1. ./configure --enable-so
2. make
3. make install

When I ran
# /usr/local/apache2/bin/apachectl start
it was fine.
But it began to show errors when I tried to run
# /etc/init.d/httpd start

My /etc/init.d/httpd is as follows

. /etc/rc.d/init.d/functions
case "$1" in
echo -n "Starting httpd: "
daemon httpd -DSSL
touch /var/lock/subsys/httpd
echo -n "Shutting down http: "
killproc httpd
rm -f /var/lock/subsys/httpd
rm -f /usr/local/apache2/logs/
status httpd
$0 stop
$0 start
echo -n "Reloading httpd: "
killproc httpd -HUP
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
exit 0

I have done
# chkconfig --add httpd
# chkconfig httpd on
# service httpd start

This command returned the following error:
[root@localhost conf]# service httpd start
Starting httpd: execvp: No such file or directory [FAILED]
I've double checked the path of apache installation and the one that I have specified in the init script.It was fine.
The solution is just simple
You can work on it in two ways.

1. Create a soft link to /usr/local/apache/bin/httpd under some System PATH
# ln -s /usr/local/apache/bin/httpd /usr/sbin/httpd
Then start httpd using the service command
2. Include the Apache Binary PATH into the /etc/init.d/functions file
Append /usr/local/apache/bin to the line similar to
Thereafter it should look like
Then start httpd using the service command

Apart from this always be aware of Permission too.
Follow ups

1 comment:

Flipper Peregrine said...

This falls into the "don't laugh at me too hard category", but I recently had a similar error with sshd. By a simple typo, after doing a "find / -name sshd", I figured out that I managed to move the entire directory "/usr/sbin" to be a sub-directory of mysql, including the sshd executable. That's what I get for upgrading MySQL after working 18 straight hours... hope this tip helps.