php wamp服务器无法打开Localhost

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20763004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:31:17  来源:igfitidea点击:

wamp server cannot open Localhost

phpwampserver

提问by Sajad

I am new in php and now i installed wampserver 2.2 application and when i click to Localhost option, the "Unable to connect" page shown in my Firefox browser.

我是 php 新手,现在我安装了 wampserver 2.2 应用程序,当我点击本地主机选项时,“无法连接”页面显示在我的 Firefox 浏览器中。

this is my www folder:

这是我的 www 文件夹:

enter image description here

在此处输入图片说明

And this is my index.phpfile:

这是我的index.php文件:

<html>
<head>
<title>  Hello To PHP Learning! </title>
</head>
<body>

<?php
    echo  'Hello World';
?>

</body>
</html>

回答by Sajad

Have you installed the C++ Redistributable Package?

你安装了C++ Redistributable Package吗?

You should install it before installing wamp!

您应该在安装 wamp 之前安装它!

回答by Balochlens

Did you Tried

你试过吗

127.0.0.1

127.0.0.1

instead of localhost

而不是本地主机

  1. IIS and Apache/Wamp are both web server and might conflict in some way, so you have to disable IIS in order for Wamp to work
  1. IIS 和 Apache/Wamp 都是 Web 服务器,可能会以某种方式发生冲突,因此您必须禁用 IIS 才能使 Wamp 工作

Disable IIS : Control Panel, Uninstall Programs, Turn Widows Features On or Off, uncheck Internet Information Services

禁用 IIS:控制面板、卸载程序、打开或关闭 Widows 功能、取消选中 Internet 信息服务

  1. if using skype, open skype > tools > options > connections > advanced > untick "use port 80 ..." then restart wamp then skype

  2. There might be port problem in httpd.conf change it to 80 instead of other ON LINE NO 40+

  1. 如果使用 Skype,打开 Skype > 工具 > 选项 > 连接 > 高级 > 取消勾选“使用端口 80 ...”然后重新启动 wamp 然后是 Skype

  2. httpd.conf 中可能有端口问题 将其更改为 80 而不是其他 ON LINE NO 40+

LISTEN 80

听 80

OR TRY TO CONNECT

或尝试连接

  • The last but not least method
  • 最后但并非最不重要的方法

Try to uninstall WAMP Server and reinstall it in another Drive except same drive.

尝试卸载 WAMP 服务器并将其重新安装在除同一驱动器之外的另一个驱动器中。

回答by Royal Bg

Your wamp server should be started (green icon in the tray), the Apache and PHP services should be ON.

您的 wamp 服务器应该已启动(托盘中的绿色图标),Apache 和 PHP 服务应该已开启。

In most of the cases wamp server launches Apache on default 80 port, which might be used (for example from Skype) when you try to start Apache, so kill processes that listen on port 80 before launching wamp.

在大多数情况下,wamp 服务器在默认 80 端口上启动 Apache,当您尝试启动 Apache 时可能会使用(例如从 Skype),因此在启动 wamp 之前终止侦听端口 80 的进程。

回答by Tanuj Verma

Causes for '404 error in wamp server': This problem happening for Port issue. You may be install some services which one taking Port 80. Like,

“wamp 服务器中的 404 错误”的原因:此问题发生在端口问题上。您可能正在安装一些服务,其中一个使用端口 80。例如,

Skype IIS Express Web Server Some Torrent Clients Teamviewer ... So only ‘HTTP 404 error page not found' happening.

Skype IIS Express Web 服务器某些 Torrent 客户端 Teamviewer ... 所以只有“未找到 HTTP 404 错误页面”发生。

Solution:

解决方案:

You have to change your wamp server Port number. Just do following simple steps,

您必须更改 wamp 服务器端口号。只需按照以下简单步骤,

Open httpd.conf file After run your wamp server, left click taskbar Wamp green icon. Then go-to Apache->httpd.conf

打开 httpd.conf 文件 运行 wamp 服务器后,左键单击任务栏 Wamp 绿色图标。然后转到 Apache->httpd.conf

(Otherwise open like: C:\wamp\bin\apache\apache2.2.22\conf )

(否则打开: C:\wamp\bin\apache\apache2.2.22\conf )

Change Listen 80 There, Line number 46 having “Listen 80″. Just replace 80 as “81″ like Listen 81

更改 Listen 80 There,第 46 行具有“Listen 80”。只需将 80 替换为“81”,就像听 81

Change ServerName localhost:80 And Line number 171 having “ServerName localhost:80″. Just replace with same number as you used Line number 46. Like, ServerName localhost:81 And save this file.

更改 ServerName localhost:80 和具有“ServerName localhost:80”的行号 171。只需替换为与您使用的行号 46 相同的编号。例如,ServerName localhost:81 并保存此文件。

Use URL Just restart your Apache or Wamp then use URL like following, localhost:81 or 127.0.0.0:81 ( here 127.0.0.0: is your wamp IP )

使用 URL 只需重新启动您的 Apache 或 Wamp,然后使用如下所示的 URL,localhost:81 或 127.0.0.0:81(此处 127.0.0.0: 是您的 wamp IP)

localhost:81

本地主机:81