0

I restart my apache on centos, I cd the apache bin dir use

apachectl restart

It's no working but I use

 /dir..../bin/apachectl restart

It's working ,why??

enter image description here

3
  • type >whereis apachectl then look where it shows Commented Sep 15, 2015 at 8:12
  • it shows "apachectl:" Commented Sep 15, 2015 at 8:14
  • sorry you should type >which apachetl Commented Sep 15, 2015 at 8:16

2 Answers 2

2

you type >which apachetl,

if result is such below

/usr/bin/which: no lsasd in (/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/turkcell/wlsadmin/bin)

you have to add its full path to PATH enviroment in order to execute command at any directory.

PATH=$PATH:/usr/local/services/apache2-2/bin
Sign up to request clarification or add additional context in comments.

Comments

1

apachectl may not be on your PATH so your OS doesn't know what that command is or where it is (even though you cd into the folder).

If you provide a path to the command Linux will know what to do with it.

If you cd into the folder and do ./apachectl restart it should work as well.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.