1

I have read the cookbook regarding deploying my symfony2 app to production environment. I find that it works great in dev mode, but the prod mode first wouldn't allow signing in (said bad credentials though I signed in with those very credentials in dev mode), and later after an extra run of clearing and warming up the prod cache, I just get http500 from my prod route.

I had a look in the config files and wonder if this has anything to do with it:

config_dev.php:

imports:
    - { resource: config.yml }

framework:
    router:   { resource: "%kernel.root_dir%/config/routing_dev.yml" }
    profiler: { only_exceptions: false }

web_profiler:
    toolbar: true
    intercept_redirects: false

monolog:
    handlers:
        main:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug
        firephp:
            type:  firephp
            level: info

assetic:
    use_controller: true

config_prod:

imports:
    - { resource: config.yml }

#doctrine:
#    orm:
#        metadata_cache_driver: apc
#        result_cache_driver: apc
#        query_cache_driver: apc

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: error
            handler:      nested
        nested:
            type:  stream
            path:  %kernel.logs_dir%/%kernel.environment%.log
            level: debug

I also noticed that there is a routing_dev.php but no routing_prod, the prod encironment works great however on my localhost so... ?

Matt Welander
  • 8,234
  • 24
  • 88
  • 138
  • The framework router param default is "%kernel.root_dir%/config/routing.yml". The config_dev.yml overrides this to load routing_dev.yml which loads some additional dev routing (for profiling) before loading routing.yml. So, no, I don't think this should be causing your problem unless you have modified routing_dev.yml and put/imported all your routes into there instead of into routing.yml – redbirdo Nov 14 '12 at 21:51
  • Also, have you tried looking in the web server / php error logs to see if there is any further info? – redbirdo Nov 14 '12 at 22:00

1 Answers1

0

In your production environment when you run the app/console cache:warmup command you need to make sure you run it like this: app/console cache:warmup --env=prod --no-debug Also, remember that the command will warmup the cache as the current user, so all files will be owned by the current user and not the web server user (eg: www-data). That is probably why you get a 500 server error. After you warmup the cache run this: chown -R www-data.www-data app/cache/prod (be sure to replace www-data with your web server user.

Make sure your parameters.ini file has any proper configs in place since its common for this file to not be checked in to whatever code repository you might be using. Or (and I've even done this) its possible to simply forget to put parameters from dev into the prod parmeters.ini file.

You'll also need to look in your app/logs/prod.log to see what happens when you attempt to login.

lifo
  • 2,791
  • 1
  • 25
  • 32
  • Thanks I will check permissions on the cache folder. I am not using a repository so that isn't an issue, also I never get to the login screen, I only get a blank page (http500 most likely) so I don't know what is gonig on. I will try and see if there is anything in the log, thanks. – Matt Welander Nov 27 '12 at 18:35
  • If its just a blank screen then its probably a permissions issue with the cache folder. Once you check that out let me know what you find. – lifo Nov 27 '12 at 19:35