Apache 2 is installed in the /etc
directory. But when I use httpd -v
开发者_开发技巧from the terminal, it gives an error stating httpd command not found. How do I fix this error?
Platform: Linux (SUSE)
Most likely it is because you are not in the user environment that has the command.
For example, if you were root, you could su -
and then try httpd -v
.
Otherwise, use the full path. In my case it is this:
/usr/sbin/httpd -v
It may be somewhere different on your system, but that is the location of that particular file even though my installation is located here: /etc/httpd/
The location of httpd
can be found out like that:
Just type in your terminal:
# whereis httpd
And you should see something like that
# whereis httpd
httpd: /usr/sbin/httpd /etc/httpd
That would be you path to apache programm.
If you are not an admin or not part of sudoer's group the outputs of this program are limited.
You won't be able to read, check, configure most configuration files. That happens to all who had shared hosting accounts with ssh access. Only some basic data available. anything that requires root access will give you errors:
#/usr/sbin/httpd -V
/usr/sbin/httpd: line 63: ulimit: open files: cannot modify limit: Operation not permitted
/usr/sbin/httpd: line 64: ulimit: open files: cannot modify limit: Operation not permitted
/usr/sbin/httpd: line 65: ulimit: open files: cannot modify limit: Operation not permitted
Or like that:
# /usr/sbin/httpd -S
/usr/sbin/httpd: line 63: ulimit: open files: cannot modify limit: Operation not permitted
/usr/sbin/httpd: line 64: ulimit: open files: cannot modify limit: Operation not permitted
/usr/sbin/httpd: line 65: ulimit: open files: cannot modify limit: Operation not permitted
httpd: Could not open configuration file /usr/local/apache/conf/httpd.conf: Permission denied
P.S.
BTW, Apache documentation doesn't recommend to invoke httpd
programm directly, instead use apachectl
精彩评论