-2

I launched a webpage(only one file index.php) on localhost port 8000 with the command

    php -S localhost:8000

My private IP address is 192.168.1.109 and I try accessing the webpage from a mobile phone on the same network, with the link

    http://192.168.1.109:8000/index.php

But I'm unable to access it. Any suggestions?

1 Answers1

0

You told the server to listen on localhost, so that is what it is doing. It is listening on 127.0.0.1 (or possibly ::1 if you're defaulting to IPv6).

If you want it to listen on 192.168.1.109 then you have to tell it to do that:

php -S 192.168.1.109:8000

Or tell it to listen on all network interfaces:

php -S 0.0.0.0:8000
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335