1. 程式人生 > >Apache之——命令列啟動出現Failed to open the Apache2.2 Service解決方案

Apache之——命令列啟動出現Failed to open the Apache2.2 Service解決方案

Apache命令列啟動[關閉|重啟]的命令是:httpd -k start[stop|restart]

出現Failed to open the Apache2.2 Service。其實是許可權問題,可以通過以下方法解決:
開啟執行 找到cmd ,右鍵開啟cmd.exe ,選擇以管理員身份執行

D:\Program Files\Apache Software Foundation\Apache2.2\bin>httpd -k install

下面是它的輸出log

Installing the Apache2.2 service

The Apache2.2 service is successfully installed.

Testing httpd.conf....

Errors reported here must be corrected before the service can be started.

然後在服務裡,把apache啟動即可。