4

I want to start a server with symfony server:start using the port that is set in my .env file. Is there a way to do this?

user2041284
  • 49
  • 1
  • 1
  • 2

2 Answers2

15

For anyone stumbling here from google like I did, use the flag --port=PORTNUMBER

Example:

symfony server:start --port=8080

OR

php bin/console server:start --port=8080

The help page documentation states this like so:

--port=value Preferred HTTP port [default: 8000]

Amelia Magee
  • 452
  • 5
  • 14
2
php bin/console server:start --help

Gives the info you want

Usage:
  server:start [options] [--] [<addressport>]

Arguments:
  addressport            The address to listen to (can be address:port, address, or port)

So type

Change the default address and port by passing them as an argument:

php bin/console server:start 127.0.0.1:8080
fliim
  • 2,059
  • 4
  • 18
  • 31