php WAMP 服务器为绿色但只得到 404

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13932857/
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 06:18:06  来源:igfitidea点击:

WAMP server in green but only get 404

phpmysqlapachewamp

提问by cschneider27

Alright ladies and gents. I have quite the puzzling issue. I have WAMP server installed on my WIN7 machine at work, everything was working fine and dandy. Didn't use it for a few weeks because I got pulled into other things. The other day I tried to start it up... The icon was green and I figured we were good. Then I tried to open up localhost and just get a 404 error:

好的女士们先生们。我有一个令人费解的问题。我在工作时在 WIN7 机器上安装了 WAMP 服务器,一切正常。几个星期没有使用它,因为我被拉到了其他事情上。前几天我试图启动它......图标是绿色的,我认为我们很好。然后我尝试打开 localhost 并收到 404 错误:

HTTP Error 404. The requested resource is not found.

HTTP 错误 404。未找到请求的资源。

I have no clue why it's doing this, we were working fine 2-3 weeks ago and now nothing. Have any of you had the green icon but couldn't get any pages to come up? Where in the heck do I go because I'm beating my head against the wall here.

我不知道为什么要这样做,我们在 2-3 周前工作得很好,现在什么都没有。有没有人有绿色图标但无法显示任何页面?我到底要去哪里,因为我在这里用头撞墙。

Thanks in advance.

提前致谢。

回答by ndsmyter

It is also possible that some other service is running on port 80 (maybe IIS Express, some Torrent clients, Skype..). A solution could be to change the port on which is being listened (as Mithun Senhas said).

也有可能在端口 80 上运行了一些其他服务(可能是 IIS Express、某些 Torrent 客户端、Skype ......)。解决方案可能是更改正在侦听的端口(如Mithun Sen所说)。

So change the port on which Wamp listens:

因此,更改 Wamp 侦听的端口:

  • Click on Wamp server -> Apache -> httpd.conf
  • Change Listen 80to something else, eg: Listen 81
  • I would also change ServerName localhost:80to ServerName localhost:81
  • 点击 Wamp 服务器 -> Apache -> httpd.conf
  • 更改Listen 80为其他内容,例如:Listen 81
  • 我也会改变ServerName localhost:80,以ServerName localhost:81

If you've done this, and saved httpd.conf, you have to restart the Wamp server. Then use localhost:81as your root url.

如果您已完成此操作并保存了 httpd.conf,则必须重新启动 Wamp 服务器。然后localhost:81用作您的根网址。

So the urls will then look like

所以网址看起来像

localhost:81/phpmyadmin
localhost:81/mysite_directory

回答by Andrew

For me, all I had to do was click the WAMP icon then click "Put Online", and it went online. It may be the case for someone else out there as well.

对我来说,我所要做的就是点击 WAMP 图标,然后点击“Put Online”,然后它就上线了。外面的其他人也可能是这种情况。

回答by Mithun Sen

try changing the port :

尝试更改端口:

click on the wamp icon -> Apache -> httpd.conf change the 'Listen 80' to 'Listen 81'.

单击 wamp 图标 -> Apache -> httpd.conf 将“Listen 80”更改为“Listen 81”。

Restart Wamp.

重启万普。

回答by Priya R

Check if the port 80 is being used by any other service. In my case the icon was brown and server was online and apacheservice wasn't started.

检查端口 80 是否正被任何其他服务使用。在我的例子中,图标是棕色的,服务器在线并且apache服务没有启动。

Here is what I did to fix it:

这是我为修复它所做的:

In my case "Web Deployment Agent Service"was using the port blocking the apache from using it.

在我的情况下,"Web Deployment Agent Service"正在使用阻止 apache 使用它的端口。

Stop the service and change its startup type to "Manual" in properties by default it is "Automatic", this will avoid the problem from reoccurring.

停止服务并在属性中将其启动类型更改为“手动”,默认为“自动”,这样可以避免问题再次发生。

Please find more detailed information on how to find and stop the service in link below : https://stackoverflow.com/a/35252219/5894548

请在下面的链接中找到有关如何查找和停止服务的更多详细信息:https: //stackoverflow.com/a/35252219/5894548

回答by YZF

Just in case anyone else has the same problem, I will post how I fixed my issue.

以防万一其他人有同样的问题,我会发布我如何解决我的问题。

I recently wanted to update my PHP in WAMP to a newer version. When that didn't work, I just decided to download a newer version of WAMP with a newer PHP version. After downloading and installing all the Visual C++ Packages I installed the new WAMP. I also downloaded a fresh version of Joomla, and put the files in the wamp/www/ directory. I opened up WAMP, got the green light, then tried to install the new Joomla. When I entered the URL: http://localhost/joomla/installation/index.phpthe file wasn't found. I didn't notice that the new WAMP I downloaded had a file name of "wamp64". I took the joomla files out of wamp/www/ and put them into wamp64/www/ and finally the installation file was found.

我最近想将 WAMP 中的 PHP 更新为更新版本。当那不起作用时,我决定下载一个更新版本的 WAMP 和一个更新的 PHP 版本。下载并安装所有 Visual C++ 包后,我安装了新的 WAMP。我还下载了新版本的 Joomla,并将文件放在 wamp/www/ 目录中。我打开 WAMP,获得绿灯,然后尝试安装新的 Joomla。当我输入 URL 时:http://localhost/joomla/installation/index.php找不到文件。我没有注意到我下载的新 WAMP 的文件名为“wamp64”。我把joomla文件从wamp/www/取出来放到wamp64/www/,终于找到安装文件了。

Maybe this piece of info will save someone else from pulling out their hair.

也许这条信息可以让其他人免于拔头发。

回答by K.Kale

If you get
HTTP Error 404. The requested resource is not found.
even Wampserver light is green check your port 80 probably it is being used by another services.
So you should do them;

1- Click on Wampserver the go to Apache -> httpd.conf
2- Find Listen 80 and change it to Listen 8080
3- save .txt filen and restart Wampserver

如果您收到
HTTP 错误 404。未找到请求的资源。
即使 Wampserver 灯为绿色,请检查您的端口 80,它可能正被其他服务使用。
所以你应该这样做;

1- 单击 Wampserver 转到 Apache -> httpd.conf
2- 找到 Listen 80 并将其更改为 Listen 8080
3- 保存 .txt 文件并重新启动 Wampserver

Note: if you have same issue after you restart your computer while port number is Listen 8080

1-Change port number again like Listen 8081 and restart all services, then click LocalHost.
2- if page opens again great, but if you had an error then change the port number back to Listen 8080 and restart it, You will see it will works..

注意:如果在端口号为 Listen 8080 的情况下重新启动计算机后遇到同样的问题

1-再次更改端口号,如 Listen 8081 并重新启动所有服务,然后单击 LocalHost。
2- 如果页面再次打开很好,但如果出现错误,则将端口号更改回侦听 8080 并重新启动它,您将看到它会起作用..



回答by Rust

My issue was that the files weren't really there.

我的问题是这些文件实际上并不存在。

I ran into this since I was upgrading from 32-bit to 64-bit.

自从我从 32 位升级到 64 位以来,我遇到了这个问题。

I had all my files were within Wampwhile localhostwas looking for files within Wamp64.

我的所有文件都在里面,Wamp而我localhost正在寻找Wamp64.

So, all I did was move files from Wamp/www -> Wamp64/www.

所以,我所做的只是将文件从Wamp/www -> Wamp64/www.

回答by Jaime Montoya

I was experiencing the same problem and I fixed it by changing the Apache port from 80 to 81:

我遇到了同样的问题,我通过将 Apache 端口从 80 更改为 81 来修复它:

enter image description here

在此处输入图片说明

You do not have to use 81. Just make sure it is not 80 and that you use a port that is free, not something that you are already using.

您不必使用 81。只要确保它不是 80 并且您使用的是免费的端口,而不是您已经在使用的端口。

enter image description here

在此处输入图片说明

I think in my case the problem started when I installed Microsoft SQL Server 2012, I think a service or something took port 80 and then when Apache tried to use it, the port was already taken. Fortunately it is an easy fix by simply using a different port.

我认为在我的情况下,问题是在我安装 Microsoft SQL Server 2012 时开始的,我认为服务或其他东西占用了端口 80,然后当 Apache 尝试使用它时,该端口已经被占用。幸运的是,只需使用不同的端口即可轻松修复。

Make sure you restart Apache at the end.

确保最后重新启动 Apache。