我已经使用 WAMP 成功运行 PHP 脚本一年左右了,但昨天我注意到脚本没有打开/运行。当我转到时http://localhost
,页面只是继续加载无限期地。当然,脚本中没有错误。
我试过:
- 重新启动所有服务
- 重新安装 WAMP
- 甚至尝试过 easyphp (类似于 wamp)
- 卸载可疑软件
当我尝试时telnet localhost 80
,它说“正在连接到本地主机……”但它从未连接。
有趣的:
能够在 PHP Designer(PHP 的编辑器)中运行脚本,但不能像之前所说的那样在使用 WAMP 的浏览器上运行脚本。
操作系统:XP SP2 带有 Avira 防病毒软件
更新: 这是我的 Apache 日志,但我不明白它说了什么:
[Wed Feb 17 10:27:35 2010] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Feb 17 10:27:35 2010] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 17 10:27:35 2010] [notice] Parent: Created child process 740
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Child process is running
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Acquired the start mutex.
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Starting 64 worker threads.
[Wed Feb 17 10:27:36 2010] [notice] Child 740: Starting thread to listen on port 80.
[Wed Feb 17 10:31:15 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 10:31:15 2010] [notice] Child 740: Exit event signaled. Child process is ending.
[Wed Feb 17 10:31:16 2010] [notice] Child 740: Released the start mutex
[Wed Feb 17 10:31:17 2010] [notice] Child 740: All worker threads have exited.
[Wed Feb 17 10:31:17 2010] [notice] Child 740: Child process is exiting
[Wed Feb 17 10:31:18 2010] [notice] Parent: Child process exited successfully.
[Wed Feb 17 10:31:28 2010] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Feb 17 10:31:28 2010] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 17 10:31:28 2010] [notice] Parent: Created child process 2200
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Child process is running
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Acquired the start mutex.
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Starting 64 worker threads.
[Wed Feb 17 10:31:28 2010] [notice] Child 2200: Starting thread to listen on port 80.
[Wed Feb 17 10:34:20 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 10:34:22 2010] [notice] Child 2200: Exit event signaled. Child process is ending.
[Wed Feb 17 10:34:24 2010] [notice] Child 2200: Released the start mutex
[Wed Feb 17 10:34:25 2010] [notice] Child 2200: All worker threads have exited.
[Wed Feb 17 10:34:25 2010] [notice] Child 2200: Child process is exiting
[Wed Feb 17 10:34:26 2010] [notice] Parent: Child process exited successfully.
[Wed Feb 17 10:43:32 2010] [notice] Apache/2.2.8 (Win32) PHP/5.2.6 configured -- resuming normal operations
[Wed Feb 17 10:43:32 2010] [notice] Server built: Jan 18 2008 00:37:19
[Wed Feb 17 10:43:32 2010] [notice] Parent: Created child process 3640
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Child process is running
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Acquired the start mutex.
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Starting 64 worker threads.
[Wed Feb 17 10:43:33 2010] [notice] Child 3640: Starting thread to listen on port 80.
[Wed Feb 17 10:46:27 2010] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Wed Feb 17 10:46:27 2010] [notice] Child 3640: Exit event signaled. Child process is ending.
[Wed Feb 17 10:46:28 2010] [notice] Child 3640: Released the start mutex
[Wed Feb 17 10:46:29 2010] [notice] Child 3640: All worker threads have exited.
答案1
关闭在端口 80 上运行的所有内容,例如 Skype(您可以在 wampserver 启动后运行 skype,但不能在此之前运行)
我在 Internet Explorer 中也遇到了同样的问题,您使用的是那个浏览器吗?如果您在 IE 中运行某些插件,它会导致此问题,例如“AVG 安全搜索”,如果我记得那是导致我出现问题的插件...但您可能需要禁用插件并尝试...尝试不同的浏览器...
编辑:还有一件事:查看我的一个关于如何编辑主机文件的教程,您可以尝试删除第 19 行并保存文件,然后重新启动服务器并再次尝试 localhost 或本地 ip 127.0.0.1
答案2
首先检查你的 apache 服务器是否正在运行。开始->运行->cmd 然后执行命令:
网络状态-abn
查找如下行的结果:
TCP 0.0.0.0:80 0.0.0.0:0 正在监听 600 [apache.exe]
如果您找不到任何在端口 80 上监听的内容(没有 0.0.0.0:80 行),那么您的 apache 无法启动。要找出无法启动的原因,您应该找到 apache 日志目录并检查 error.log(可能是您最近更新了 php?)。如果您发现 0.0.0.0:80 监听行,但其他一些软件正在监听那里(您是否正在运行 IIS?),那么您应该删除/重新配置该软件以释放端口 80。如果您的 apache 正在监听端口 80,但仍然无法打开您的站点,并且您无法通过检查 apache 日志文件找出问题的原因,那么这可能是数据库问题。使用相同的命令检查您的 mysql 是否正在运行和监听,但您应该寻找
TCP 0.0.0.0:3306 0.0.0.0:0 正在监听 [mysqld-nt.exe]
如果您找不到这样的行,则说明您的 mysql 服务器未运行 - 检查 mysql 日志文件中是否有错误。如果两个服务器都在运行,而您无法在浏览器中获得任何输出,则请检查您的防火墙和防病毒软件 - 它们可能会阻止您的请求。希望这能有所帮助 ;)
答案3
打开命令提示符并确认:
telnet localhost 80
无法连接,可能是防火墙丢包了。请尝试关闭防火墙。
或者您的 Web 服务器(apache?)没有响应并且挂起了。尝试:停止 apache,确认 apache 不再运行(检查任务管理器),然后启动 apache。