Screen Shot 2014-11-18 at 1.55.52 PM The only way I’ve been able to bring up the Symfony Demo home page is to use the app_dev.php and use the dev environment.

In other words, going to the ‘/’ URI hasn’t been working unless I use the dev environment. If my domain is, then is not working – it gives a 404 error. If I use then it worked.

Today I finally figured out why. After doing a little searching, I realized that since it’s the production environment, I probably needed to clear the cache.

Ahh, the good ol’ Symfony cache! I had almost forgotten about you. I thought I read somewhere that you didn’t have to do this anymore, but I see that you do. Clearing the cache worked perfectly.

php app/console cache:clear --env=prod

You can also just delete the app/cache/prod folder and it’s contents.

2 thoughts on “Symfony app.php prod Environment Not Working on Demo – 404 error”

  1. you are right, I cleared the cache and it worked, I also read that line, but if i understand it correctly, it will be cleared automatically when you are in debug mode:

    “When the front controller initializes the kernel, it provides two parameters: the environment, and also
    whether the kernel should run in debug mode. To make your application respond faster, Symfony maintains a cache under the app/cache/ directory. When debug mode is enabled (such as app_dev.php
    does by default), this cache is flushed automatically whenever you make changes to any code or
    configuration. When running in debug mode, Symfony runs slower, but your changes are reflected
    without having to manually clear the cache.”

  2. Yes, jovani, I believe you are correct. But, the production environment and the dev environment have their own caches. So, running the dev environment clears it’s cache, but doesn’t seem to touch the production cache. So, we have to clear the production cache ourselves.

Leave a Comment

Your email address will not be published. Required fields are marked *