Symfony: disable exceptions in prod mode

自作多情 提交于 2020-01-16 12:09:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!