Search code examples
symfony4

php -S 127.0.0.1:8000 -t public not works


When I run this command: php -S 127.0.0.1:8000 -t public the error is:

Could not open input file: 127.0.0.1:8000

I'm using symfony 4, when I lunch the server with the command php bin/console server:run it works, but with command php -S 127.0.0.1:8000 -t public it doesn't work.


Solution

  • Please try php -S localhost:8000 -t public, which is literally the same, but... who knows ;)

    There is also an option to run php -S 0.0.0.0:8000 -t public, but in if your PC connected to the internet directly, your "web server" will be accessible from the internet.

    And, just in case, if you will see error like this: Directory public does not exist. that will mean that you have run the command in the wrong folder. -t public means that you need to run the command in the folder which contain the public folder.