Symfony 5.1.2 page not found with new project

Viewed 5282

I created a new project using Symfony 5.1.2, then I tried to run the server using symfony serve. Once I tried to access localhost:8000, I had this warning in the terminal : [Web Server/PHP ] Jun 22 13:47:55 |WARN | SERVER GET (404) / ip="::1".

Moreover, the page I had was symfony's default page saying "#Page not found".

I checked the existing routes and I had default ANY ANY ANY /.

I also checked the DefaultController, but everything looks fine, since it is the auto generated controller...

I don't know what else to check, how could I get this default page working ?

3 Answers

I had a similar issue : I had run symfony server:start and was even seeing it react to my entering HTTP addresses in the browser, but I kept having that "# Page not found" message.

Quite simply, my symfony project was in Group/SubGroup/Project... and I was running symfony server:start from Group/SubGroup. When I stopped Symfony and ran it again from Group/SubGroup/Project, it worked like a charm.

A beginner's mistake, to be sure, but beginners use this site too.

Did you run the symfony project? It will show if you didn't run the symfony project. Run the project from terminal.

cd my-project/
symfony server:start

ip="::1" is the localhost on windows and wsl 2. Symfony server listen on 127.0.0.1:8000. You must edit the windows hosts file at C:\Windows\System32\drivers\etc\hosts. Add this line : 127.0.0.1:8000 localhost:8000 It works for me.

Related