如果 Apache 已安装并正在运行,“apache2ctl:: command not found”是什么意思?

blu*_*ers 3 linux configuration web-server apache-2.2

尝试运行命令“apache2ctl restart”并刚刚收到此消息“apache2ctl:: command not found”——事实是,Apache已安装,正在运行,我现在正在服务器上积极进行开发......任何想法?

上下文:在虚拟机上的 CentOS-5.5 上的 sudo 访问


更新:好消息,重新启动 Apache,坏消息 500 错误,仍在进行中... :-)

[username@VMname /]$ sudo /etc/init.d/httpd restart
[username@VMname /]$ sudo /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
Run Code Online (Sandbox Code Playgroud)

EEA*_*EAA 5

看起来apache2ctl不在您的路径中。试试这个:

$ sudo /usr/sbin/apache2ctl restart
Run Code Online (Sandbox Code Playgroud)

以上位置反映了apache2ctl在 Ubuntu 中的位置。我不确定 CentOS 上的默认位置在哪里。如果上述命令不起作用,您可以通过以 root 身份运行以下命令来查找位置:

$ which apache2ctl
Run Code Online (Sandbox Code Playgroud)