问题
I'm a beginner with Symfony.
I have a Symfony 3.1 project. I put y project on my remote server. Everything works fine. Then I use SensioLabsInsight to check errors in my project. This analyse tool gives me those 2 warnings messages
: "Exceptions should not be enabled in production" and "Symfony applications should not contain a config.php file"
Then my first question is how can I disable Exceptions in production ? My second question is may I remove the config.php file in production (located in myBundle/web/config.php) ?
回答1:
Then my first question is how can I disable Exceptions in production ?
As far as I can see when searching this on Google, I think it's because the second parameter passed to new AppKernel('prod', ...); is true, which enables debug mode. Set it to false. (same applies to debug settings in config_prod.yml).
My second question is may I remove the config.php file in production (located in myBundle/web/config.php) ?
Yes, also remove any front-controller (like app_dev.php) except from your production one. Remember: The standard edition is just a recommendation. Symfony doesn't force you any file or directory in the directory structure.
来源:https://stackoverflow.com/questions/38922231/symfony-disable-exceptions-in-prod-mode