I've been using the 5.4+ built-in webserver in PHP cli, invoked via:
php -S localhost:8080
... and all looks fine on the local PC when accessing http://localhost:8080
. So I wanted to test from another device on the local network, but the localhost
invocation does not make the server available on the local network. So, I've found that 0.0.0.0
can be used to listen on all interfaces (Running PHP 5.4 built-in web server outside localhost), and I tried that invocation:
php -S 0.0.0.0:8080
Now, I try to access this from the device, and I notice some links cannot be clicked. I try to investigate back on the local PC which hosts the PHP server; and there, when I issue:
http://localhost:8080/dir/
... the server logs it as (there is index.php
in /dir/
):
[Thu Oct 22 22:56:02 2015] 127.0.0.1:59752 [200]: /dir/
... and this one works fine, no problem.
But when I call the local IP of the computer, for instance:
http://192.168.0.150:8080/dir/
... PHP logs it as:
[Thu Oct 22 22:56:14 2015] 192.168.0.150:57847 [200]: /dir/
... and this page I cannot click ???!!!!???!
So, I saved the server HTML in both cases, ran a diff, and turns out there are differences like:
...
<!-- </div> -->
-<div style="width: 612px;" class="testB my_class" id="testB">
+<div class="testB" id="testB">
<div class="test" id="test">
...
So, basically, the very same instance of the PHP cli server, serves two different pages, based on the address it was called by????!!!
Anyone have any idea why? Version:
$ php --version
PHP 5.5.9-1ubuntu4.13 (cli) (built: Sep 29 2015 15:16:25)