1

I made a PHP router "router.php" and I can simply run it using:

php -S localhost:nnnn [address]/router.php

nnnn is the port I used for connection.

My os is Lubuntu and I can test the router PHP in Lubuntu Firefox browser using:

localhost:nnnn/?

And it works great but, my problem is I can not use it with the same method on my Android device.

I tested 192.168.x.x:nnnn in my Android browser but its not working.

My laptop and phone are connected to a Wi-Fi modem/router and 192.168.x.x is my laptop local IP address.

I turned off my firewall but it's not working yet.

Shamshirsaz.Navid
  • 2,224
  • 3
  • 22
  • 36
  • I think the problem is that you have to allow connections other than localhost. Check this answer there.. http://stackoverflow.com/questions/19132059/how-to-allow-remote-access-to-my-wamp-server-for-mobileandroid?answertab=active#tab-top – user2399432 Sep 09 '16 at 09:22
  • ok, i checked this link and it seems reasonable. should i change chmod of /www root or should i pass some kind of httpd.conf file for php built-in server ? – Shamshirsaz.Navid Sep 09 '16 at 10:01
  • i found these threads (http://stackoverflow.com/questions/8377178/running-php-5-4-built-in-web-server-outside-localhost) and (http://php.net/manual/en/features.commandline.webserver.php) and i test `php -S 0.0.0.0:8000 [address]/router.php` but still not working :/ i also turned on and off my gufw. – Shamshirsaz.Navid Sep 09 '16 at 10:59
  • ok. i reset my modem and now the solution of (http://stackoverflow.com/questions/8377178/running-php-5-4-built-in-web-server-outside-localhost) works fine :) These codes working well `php -S 0.0.0.0:8000 /address/www/router.php` and `192.168.x.x:8000 /address/www/router.php` i also added a rule in gufw `policy:allow, direction:in, protcol:TCP, port:8000` – Shamshirsaz.Navid Sep 09 '16 at 11:49
  • One more thing if helps anybody, 192.168.x.x is local server ip; im my case, my laptop ;) – Shamshirsaz.Navid Sep 09 '16 at 12:00

0 Answers0