Skip to content

[Commands] server:run ignores environment #7430

@svperfecta

Description

@svperfecta

Issue

When I use:

php app/console --env=prod server:run 

I would expect Symfony to run in production mode. However, it continues to load my config_dev.yml.

Rationale

Having this work properly would be useful in many situations, testing custom error pages for example, which won't load in development. This also maps mentally to other popular web frameworks that support running using a languages built in web server in any mode supported by the framework.

Research

It appears that Symfony2 loads the simple router bundled with the Framework Bundle, which in turn always loads app_dev.php. The offending line is here:

https://github.com/symfony/FrameworkBundle/blob/master/Command/ServerRunCommand.php#L84

The server:run command DOES allow you to load a custom router, but this seems inappropriate in this situation. For something like production mode, it should simply work as you'd expect.

I'm not familiar enough with the underbelly of Symfony2 to actually fix this. Any thoughts?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy