0

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) ?

zm455
  • 489
  • 11
  • 26

2 Answers2

3

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.

Wouter J
  • 41,455
  • 15
  • 107
  • 112
  • I had solved the problem by myself by searching in google. Because Your answer is right I vote for it. – zm455 Aug 12 '16 at 18:03
  • @zm455 please accept the answer (if it's correct), this will help further visitors to quickly find the answer. – Wouter J Aug 12 '16 at 18:15
0

In the new Symfony version, there is a new var APP_DEBUG, which you send to Kernel in the second parameter. Just add new var to your .env file

APP_DEBUG=false

return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);