I have installed Symfony2, after fixing the file permissions, I can access the dev environment from my browser by pointing it to:
http://localhost/app_dev.php
However, when I try to access the production environment by pointing the browser to http://localhost
, I get the following exception (from app/logs/prod.log):
[2012-08-13 11:30:03] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /" (uncaught exc eption) at /path/to/frameworks/Symfony2/app/cache/prod/classes.php line 4584 [] []
I then checked the available routes for the prod environment from the command line. here is the result of that investigation.
root@yourbox:~/path/to/frameworks/Symfony2$ php app/console router:debug -e=prod [router] Current routes Name Method Pattern
Incredibly, it shows that there are no routes defined for this environment (I didn't believe the error message - which essentially said the same thing).
So, my conclusion is this: out of the box installation of Symfony2, and the production environment has no default routes - is this true, or have I made a mistake somewhere?
More importantly, how do I fix this?. In SF1.x, it was straight forward to switch from dev to prod and vice versa. How do I view the AcmeDemo
app for example, in a prod environment. ?
[[UPDATE]]
After feedback from thecatontheflat, I added a simple test route to my routing.yml file. The contents of app/config/routing.yml are now:
_welcome2:
pattern: /test
defaults: { _controller: AcmeDemoBundle:Welcome:index }
When I try http://localhost/test
in the browser, I get the same 404 error. When I debug the routes available at the console, I get the following output:
root@yourbox:~/path/to/frameworks/Symfony2$ php app/console router:debug -e=prod
[router] Current routes
Name Method Pattern
_welcome2 ANY /test
routing_prod.yml
androuting_dev.yml
. You should check that places. – Vitalii Zurianrouting_dev
to be accessible in prod environment - you have to move them torouting.yml
. – Vitalii Zurian