简体   繁体   English

当我使用我的IP地址而不是localhost作为URL时出错

[英]error when i used my ip address instead of localhost as URL

I have downloaded WAMP server and i have written a very very simple php code and saved it in 我已经下载了WAMP服务器,我编写了一个非常简单的PHP代码并将其保存

C:\\wamp\\www\\php_lear C:\\ WAMP \\ WWW \\ php_lear

folder. 夹。 I have tested it using chrome giving url as 我用chrome给出了url测试它

{localhost/php_lear/eg2.php} {本地主机/ php_lear / eg2.php}

And it worked fine. 它工作得很好。 This uses a database stored in phpmyadmin. 这使用存储在phpmyadmin中的数据库。 I found out my ip address from google 117.195.230.41. 我从谷歌117.195.230.41找到了我的IP地址。 When i give 当我给

{117.195.230.41/php_lear/eg2.php} {} 117.195.230.41/php_lear/eg2.php

as URL it gives me 404 not found 作为URL它给我404找不到

"The requested URL '/php_lear/eg2.php' was not found on this server" “在此服务器上找不到请求的网址'/php_lear/eg2.php'”

Please help. 请帮忙。 I have no knowledge of ips and urls and very new to this field and yeah i have added this ip as allowed user in phpmyadmin. 我不知道ips和urls,对这个领域很新,是的,我已经在phpmyadmin中添加了这个ip作为允许的用户。 I actually want to use this in my android app. 我实际上想在我的Android应用程序中使用它。

The IP address you get from google is the IP address of your router. 您从谷歌获得的IP地址是路由器的IP地址。 It does not point to your computer. 它没有指向您的计算机。 As some ppl said, besides there is different ports to use in a connection and your WAMP installation is "listening" on the port 80 of your computer (127.0.0.1) 正如一些人说的那样,除了在连接中使用不同的端口,你的WAMP安装在计算机的端口80上“监听”(127.0.0.1)

When you access to the 117.195.230.41 you are accessing to the IP that your Internet Service Provider gives to your installation. 当您访问117.195.230.41时,您将访问Internet服务提供商为您的安装提供的IP。 So you need to access your router and redirect all the querys to the 117.195.230.41 on port 80 to your port 80 and the IP of your computer in your local network. 因此,您需要访问路由器并将所有查询重定向到端口80上的117.195.230.41到您的端口80以及本地网络中计算机的IP。

The Public/Private IP confusion is a common misunderstanding. 公共/私人知识产权混淆是一种常见的误解。

Mike is correct. 迈克是对的。 Due to how IP addressing works, there's a limited number of addresses. 由于IP寻址的工作原理,地址数量有限。 As a result, Network Address Translation was born (among other irrelevant things). 结果,网络地址转换诞生了(其他无关紧要的事情)。 The Public IP is what the world sees when it glances at your traffic. 公共知识产权是世界在看到您的流量时所看到的。 You want your Private IP, the one your router's DHCP has given you. 您需要您的专用IP,即路由器的DHCP为您提供的IP。

1) Open command prompt. 1)打开命令提示符。

2) Issue the command "ipconfig" (without the quotes). 2)发出命令“ipconfig”(不带引号)。

3) Find your "IPv4 Address". 3)找到您的“IPv4地址”。 That's the one you want. 这就是你想要的那个。

Additionally, follow Surt's suggestion to get everything working properly. 此外,请遵循Surt的建议,让一切正常运作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM