php artisan serve --host 0.0.0.0 can't be accessed from mobile device on same network

RichardManson picture RichardManson · Aug 23, 2018 · Viewed 9.6k times · Source

I have attempted to share my laravel project over a shared network, using;

php artisan serve --host 192.168.X.XXX --port 8000

This works and produces no errors but I still can't access my application on other machines connected to the same wifi network, using my Mac's ip address to connect.

I have tried different ports and changed the ip address of my Mac to try and fix it but nothing has worked so far.

Any idea what could be causing this issue? Any suggestions would be greatly appreciated, thanks!

Answer

AnyKey picture AnyKey · Aug 23, 2018

Because 0.0.0.0 is another name of 127.0.0.1 and "localhost". 0.0.0.0 means any local (internal) interface. You must use IP of your local network (i.e 192.168.x.x)