Specify Port From Command Line
You can write your code like below.
php artisan serve --port=9000
php artisan serve --host=127.0.0.2
Specify Port From Configuration File
The 2nd method is to specify the port from the configuration file or right away export it from the terminal and you can write it like the following.
Specify the file definition inside the .env environment file.
# .env file SERVER_PORT="9000"
export SERVER_PORT="9000"
php artisan serve
Leave a reply