Set port for php artisan.php serve

Laravel 5.8 to 8.0 and above

Simply pass it as a paramter:

php artisan serve --port=8080

You may also bind to a specific host by:

php artisan serve --host=0.0.0.0 --port=8080 

Or (for Laravel 6+) you can provide defaults by setting SERVER_PORT and SERVER_HOST in your .env file. You might need to do php artisan cache: clear as well. (thanks @mohd-samgan-khan)

And if you want to run it on port 80, you probably need to sudo.


as this example you can change ip and port this works with me

php artisan serve --host=0.0.0.0 --port=8000

One can specify the port with: php artisan serve --port=8080.


You can use many ports together for each project,

  php artisan serve --port=8000

  php artisan serve --port=8001   

  php artisan serve --port=8002

  php artisan serve --port=8003