Reputation: 95
When I type in
php artisan serve --host test.com
I got this error
[Wed Jan 14 12:54:12 2015] Failed to listen on test.com:8000 (reason: Can't assign requested address)
so I tried
php artisan serve --host test.com --port 8080
and I still got the same error just the port number is different. And it's the same with every number I can think of.
Upvotes: 2
Views: 8054
Reputation: 11
Use php artisan serve --port='YOUR-PORT' command.
or
you can create a variable SERVER_PORT in your .env file
Example:
SERVER_PORT=80
Upvotes: 0
Reputation: 387
sometimes your IP address get changed so first go to command prompt and type ipconfig there ipv4 address will be listed copy it and the go to terminal type php artisan serve --host youripaddress. Cheers
Upvotes: 0
Reputation: 10794
You're trying to assign a port on another server, to get around this you can either add that domain into your "hosts" file, or use a port on localhost.
On most linux distributions it's here: /etc/hosts
and on mac: /private/etc/hosts
.
You should add a new line following the format of the other lines in the file. Assign the IP of localhost (127.0.0.1) to that domain like so:
127.0.0.1 test.com
Now you will be able to open ports on localhost, using test.com:
php artisan serve --host test.com --port 8080
...and now you can access your app, in your browser via: http://test.com:8080
.
Alternatively just assign a port on locahost:
php artisan serve --host localhost --port 5000
and access in your browser via: http://localhost:5000
Upvotes: 2