Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 824
RichardManson Avatar asked Aug 23 '18 14:08

RichardManson


People also ask

Why php artisan serve not working?

Reasons why php artisan serve not working You are running php artisan serve command in wrong directory. php artisan serve is laravel command only work with laravel project. Check project directory and run in root directory of your project. The requested host or port is not available.

What happens when php artisan serve?

The Laravel PHP artisan serve command helps running applications on the PHP development server. As a developer, you can use Laravel artisan serve to develop and test various functions within the application. It also accepts two additional options. You can use the host for changing application's address and port.


1 Answers

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)

like image 184
AnyKey Avatar answered Oct 25 '22 19:10

AnyKey