Reputation: 1627
I am trying to install Symfony 2 on Windows 8.1. I am using wampp server as my localhost.
First of all I used this command to get symfony file downloaded:
php -r "readfile('http://symfony.com/installer');" > symfony
Than I used:
php symfony
After that I created a project:
php symfony new my_project
Than I used this command to run:
php app/console server:run
It successfully run but when I visit: http://localhost:8000/ . It opens a symphony page with this error:
No route found for "GET /"
404 Not Found - NotFoundHttpException
1 linked Exception:
ResourceNotFoundException »
[2/2] NotFoundHttpException: No route found for "GET /" +
[1/2] ResourceNotFoundException: +
Logs -
1 error
ERROR - Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\NotFoundHttpException: "No route found for "GET /"" at D:\Coding\www\my_project\vendor\symfony\symfony\src\Symfony\Component\HttpKernel\EventListener\RouterListener.php line 159
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\EventDispatcher\Debug\WrappedListener::__invoke".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
Stack Trace (Plain Text) +
How do I fix this?
Upvotes: 2
Views: 577
Reputation: 1120
It is normall message as after instalation of default version of symfony2 it does not have any routes defined.
First of all try http://localhost:8000/app_dev.php/ instead of http://localhost:8000/.
You can also create a controller with a default route to be able to check if everything is working fine.
// src/AppBundle/Controller/MainController.php
// ...
class MainController extends Controller
{
/**
* @Route("/")
*/
public function homepageAction()
{
die ("Everythig works fine");
return true;
}
}
In addition this may be because your demo route is equal to /app/example or something like that. Go to DefaultController in your AppBundle and change @Route parameter to single slash /
https://symfony.com/doc/current/book/routing.html
Upvotes: 2