运行cmd,在Apache安装目录下的bin目录下执行命令httpd -t,里面会提示你的Apache的配置文件是否有错误,如果有误按提示(会提示哪一行有错误),修改Apache安装目录下的conf下的httpd.conf文件
Syntax error on line 133 of D:\Program Files\Apache Software Foundation\Apache2.2/conf/httpd.conf:
打开httpd.conf,发现133行是这样的东西:ServerAdmin。
上面还有一些解释是这样说的:
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin
启动apache会出现下面的错误提示:
The requested operation has failed
把上面那几行改成这个样子
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#ServerAdmin
然后把apache装成WINDOWS的服务,方法是这样的。进入到D:\Program Files\Apache SoftwareFoundation\Apache2.2\bin\目录下,执行下面的命令: httpd.exe -k install -napache2.2,这样apache就做为windows的一项服务了,启动apache。
如果还有提示,可能是IIS或迅雷占用了80的端口,将迅雷或IIS的端口改为其他未用的,或httpd.conf文件,修改Listen 80为没被占用的端口。
这样就可以把Apache给启动起来了。