I have been trying to make things work for a while now but I did not succeed. I also have done a lot of research, in vain. I really hope that someone is able to help me find the root cause of that issue:
I am trying to connect to my localhost:8000 from another computer (which actually is an arduino ethernet but that doesn't make a difference I guess) by using an ip address. I set the ip address manually in network settings (192.168.1.5).
funny enough, the connection from the external device to 192.168.1.5:80 (which is the normal apache server) works, hence the problem cannot be IP-based.
However, the connection to the php built in webserver running on localhost:8000 does not work. I am trying to access it with '192.168.1.5:8000' obviously - I guess this can not be the mistake?
Now I am wondering what the cause of the problem is. Is anything preventing the connection to port 8000 or does the php built in webserver not respond to the manually given ip? Why does the apache respond to that IP though?
Thanks so much for any hint!! Steffen
Type the string “http://” followed by the IP address and then a forward slash. For example, type “http:// 209.191. 122.70/” (without the quotes).
Determining IP Address using $_SERVER Variable Method : There is another way to get the IP Address by using the $_SERVER['REMOTE_ADDR'] or $_SERVER['REMOTE_HOST'] variables. The variable in the $_SERVER array is created by the web server such as apache and those can be used in PHP.
If you haven't heard yet, you should probably know starting from PHP 5.4, PHP has a built-in web server. In this tutorial, we will teach you how to use PHP built-in web server. And show you how we can actually take advantage of this simple web server to do some fun stuff.
For the local address field, enter localhost: followed by the port that your proxy server is running on. For example, if it's running on port 8000 , then you would enter localhost:8000 .
The built in server is, by default, only available on localhost. You have to provide a address wildcard mask, if you want to access it over the local network.
$ php -S 0.0.0.0:8000
However, please be aware of the security implications. If your machine is connected to the internet directly, automatic port scanners will find it sooner or later and may take advantage of security problems. An address mask of 0.255.255.255 will do fine for 10...* networks, and 0.0.255.255 will do fine for 192.168.. networks.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With