1、我使用httpd.exe执行以下命令时,
apache\bin\httpd.exe -k stop
apache\bin\httpd.exe -k uninstall
apache\bin\httpd.exe -k install
apache\bin\httpd.exe -k start
出现端口被占的问题,用netstat -ano|findstr "80",查了一下,是线程PID为1108的线程占用了它,再用tasklist|findstr "1108"发现是httpd.exe占用了它。
2、我当时很纳闷,httpd.exe和Apache怎么能都占用了80端口呢?后来上网一查,原来httpd.exe是Apache的载体,httpd.exe占用了80端口,也就等价于Apache占用了80端口。
3、百思不得其解中,我在网上查找类似错误,无意间发现一个词taskkill。这时我才恍然大悟,原来是有可能有一个httpd.exe已经启动。于是我就使用taskkill /f /t /im httpd.exe把这个线程给紧了,在执行刚刚的代码,结果还真的成功了。太不可思议了。
4、很多时候,要换个思维思考问题,中午吃饭后出去走走是个不错的选择。