spectatorx
spectatorx

Reputation: 373

Symfony 2: "No route found for "GET /" - error on fresh installation

I am trying to begin my education of symfony 2 and started with it's tutorial. One of first things I tried was to install symfony 2 and configure it.

When I try to access http://127.0.0.1:8000/, I am getting an incomplete site with the following error:

ERROR - Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /"" at /home/spectator/webprojects/cls/app/cache/dev/classes.php line 2059

Things I have tried so far:

Upvotes: 1

Views: 14221

Answers (5)

I had the same problem. Just add <?php in the top of the file. Looks like if we don't specify it s

Upvotes: -1

Javier Eguiluz
Javier Eguiluz

Reputation: 4107

In the past, a fresh Symfony installation also included some simple demo code to learn how does the framework work. A few months ago we decided to change this behavior by the following:

  1. A fresh Symfony installation no longer contains any demo code.
  2. A new "Symfony Demo Application" has been published for people learning the framework (read more about this demo application).

If you use the Symfony Installer, you should do the following:

  1. When learning Symfony, execute the symfony demo command
  2. When creating a new Symfony project, execute the symfony new my_project command

Upvotes: 0

Webkix
Webkix

Reputation: 36

Try http://localhost:8000/app/example

Fresh installation has no routes for the root path "/"

Upvotes: 2

John Cartwright
John Cartwright

Reputation: 5084

The default installation does not come with a default route for "/".

The example controller only defines a route of

@Route("/app/example", name="homepage")

Upvotes: 0

uelei
uelei

Reputation: 36

first you need to set a default route edit the routing.yml app/config/routing.yml

app:
resource: @AppBundle/Controller/  # bundle name / Controller name
type:     annotation  # type of routing or 
# app/config/routing.yml   # file routing 


app: 
resource: @AppBundle/Controller/ 
prefix: / 

you can learn more in http://symfony.com/doc/current/book/routing.html

Upvotes: 0

Related Questions