Search code examples
laravellaravel-5

Failed to listen on localhost:8000 (reason: Cannot assign requested address)


When I run php artisan serve on Ubuntu, the Laravel development server tries to start on http://localhost:8000/ but fails with this error:

[Mon Apr 25 10:28:08 2016] Failed to listen on localhost:8000 (reason: Cannot assign requested address)

My hosts file (/etc/hosts/):

1 27.0.0.1   localhost 

How can this be fixed?


Solution

  • That's usually because the port is in already in use, or not available on the current host.

    You can use this command to run php artisan serve --port=8080