To specify a port for the PHP development server when using the php artisan serve
command, you can use the --port
option followed by the desired port number. For example:
php artisan serve --port=8000
This will start the development server on port 8000. If you omit the --port
option, the development server will use the default port of 8000.
You can also use the -p
option as a shorthand for --port
:
php artisan serve -p 8000
Note that some port numbers are reserved for specific purposes, and you may need to use a different port number if the one you choose is already in use or if you do not have permission to use it. Commonly used port numbers include 80 for HTTP and 443 for HTTPS.