7
votes

I have routes like: /, /login, /register, etc that work fine in dev environment.

At first i got 404 error when tried to access my site through app.php instead of app_dev.php

Then i followed this advice and cleaned up my cache.

But now i'm getting a blank screen trying to access any of the registered routes like app.php/ or app.php/login.

I found this message in prod.log:

[2012-02-24 11:27:05] request.ERROR: Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET /login" (uncaught exception) at /home/renat/www/ptracker/app/cache/prod/classes.php line 4564 [] []

Here is my routing.yml:

PtrackerTasksBundle:
resource: "@PtrackerTasksBundle/Resources/config/routing.yml"
prefix:   /

PtrackerAuthBundle:
resource: "@PtrackerAuthBundle/Resources/config/routing.yml"
prefix:   /

routing.yml in AuthBundle:

homepage:
pattern:  /
defaults: { _controller: PtrackerAuthBundle:Default:index }

register:
pattern:  /register
defaults: { _controller: PtrackerAuthBundle:Default:register }

login:
pattern:  /login
defaults: { _controller: PtrackerAuthBundle:Default:login }

activate:
pattern:  /activate/{username}/{salt}
defaults: { _controller: PtrackerAuthBundle:Default:activate }

login_check:
pattern:  /login_check

routing.yml in TasksBundle:

tasks:
pattern:  /tasks
defaults: { _controller: PtrackerTasksBundle:Default:index }

tasks_add:
pattern:  /tasks/add
defaults: { _controller: PtrackerTasksBundle:Default:add }  

tasks_view:
pattern:  /tasks/view/{id}
defaults: { _controller: PtrackerTasksBundle:Default:view, id : null }  

tasks_change_responsible:
pattern:  /tasks/change_responsible/{id}/{responsible}
defaults: { _controller: PtrackerTasksBundle:Default:change_responsible, _format: json }  

tasks_change_status:
pattern:  /tasks/change_status/{id}/{status}
defaults: { _controller: PtrackerTasksBundle:Default:change_status, _format: json }    

tasks_edit:
pattern:  /tasks/edit/{id}
defaults: { _controller: PtrackerTasksBundle:Default:edit } 

What did i miss or what am i doing wrong?

3
What does php app/console router:debug -e=prod output?meze
[RuntimeException] Unable to write in the cache directory (/home/renat/www/ptracker/app/cache/prod) Now it works with 777 rights :)mennanov

3 Answers

12
votes

First, review in console list of routes (command router:debug). If there you found your routers, then some troubles with clearing cache in my case I delete folder app/cache manually and it works.

For setting PROD environment without cache, in file app.php change to

$kernel = new AppKernel('prod', true);
9
votes

Try clearing cache on prod enviroment.

php app/console cache:clear --env=prod --no-debug
0
votes
app/console cache:clear

or

active mod_rewrite in

activate the directory:  nano /etc/apache2/apache2.conf

AllowOverride None
<Directory "/var/www/html">
    AllowOverride None
</Directory>
for
<Directory "/var/www/html">
    AllowOverride All
</Directory>

http://www.dev-metal.com/enable-mod_rewrite-ubuntu-14-04-lts/