title: Symfony 4: How to disable profiler in test-env through command line
body: <p>I am trying for quite some time now to disable the profiler in the test-environment. The only way it works is manually setting <code>APP_ENV=test</code> in file <code>.env</code> but I want to do this through the command line, not by editing a file.</p>
  
  <p>Here's everything I tried:</p>
  
  <ul>
  <li><p>I tried editing <code>bin/console</code> like described in Chris Brown's answer in this thread: <a href="https://stackoverflow.com/questions/49345965/load-different-env-file-with-a-symfony-4-command">Load different .env file with a Symfony 4 command</a> (I also added the file <code>.env.test</code>, and according to xdebug it loads the appropriate file and runs through the appropriate code and also the variables <code>$env</code> and <code>$debug</code> get the appropriate value when I run the server with <code>--env=test --no-debug</code>)</p></li>
  <li><p>I tried setting <code>profiler: enabled: false</code> like described in flu's answer in this thread: <a href="https://stackoverflow.com/questions/13901972/how-to-disable-profiler-in-symfony2-in-production">How to disable profiler in Symfony2 in production?</a> (in config/packages/test/framework.yaml)</p></li>
  <li><p>I tried setting the profiler line in bundles.php to</p></li>
  </ul>
  
  <p><code>Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class =&gt; ['dev' =&gt; true],</code></p>
  
  <p>and to </p>
  
  <p><code>Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class =&gt; ['dev' =&gt; true, 'test' =&gt; false, 'test_cached' =&gt; false],</code></p>
  
  <p>I tried those solutions separately and also all together, still the profiler keeps popping up. Does anybody have an idea?</p>
  
  <p><strong>EDIT:</strong>
  After applying Alister Bulman's answer the command gives me this:</p>
  
  <pre><code>#php bin/console -e test debug:config framework profiler
  
  Current configuration for "framework.profiler"
  ==============================================
  
  enabled: true
  collect: false
  only_exceptions: false
  only_master_requests: false
  dsn: 'file:%kernel.cache_dir%/profiler'
  </code></pre>
  
  <p><strong>EDIT 2:</strong>
  Thanks to Jared Farrish I just found out the browser is receiving the website in "dev" mode although the server is started in test environment on cli. Obviously editing <code>bin/console</code> and <code>public/index.php</code> is not enough, they're not called when the server receives a request from the browser. </p>
  
  <p><strong>EDIT 3:</strong>
  So I found out the http request goes first to <code>public/index.php</code>, but whatever I do, I cannot seem to make anything available there which was defined in <code>bin/console</code> although the whole server is started there in the first place. Anyone an idea how this can be done?</p>