Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

There is no extension able to load the configuration for "web_profiler"

Tags:

symfony

I'm quite new so Symfony2 and want to create a new environment called "dp". But for some reason I keep getting errors.

FileLoaderLoadException: Cannot import resource "/a/b/c/d/e/app/config/config_dev.yml" from "/a/b/c/d/e/app/config/config_dp.yml".
InvalidArgumentException: There is no extension able to load the configuration for "web_profiler" (in /a/b/c/d/e/app/config/config_dev.yml). Looked for namespace "web_profiler", found "framework", "security", "twig", "monolog", "swiftmailer", "doctrine", "assetic", "sensio_framework_extra", "jms_security_extra", "smarty", "bela_meter", "bela_invoice", "bela_util"

I followed the Symfony2 documentation steps The contents of app/config/config_dp.yml is

imports:
- { resource: config_dev.yml }

And web/app_dp.php contains:

$kernel = new AppKernel('dp', true);
$kernel->loadClassCache();
$kernel->handle(Request::createFromGlobals())->send();

How can I fix this? config_dev.yml environment works flawless.

like image 855
dompie Avatar asked Mar 27 '12 15:03

dompie


2 Answers

By default, WebProfilerBundle is loaded in dev and test environments only. Find this code snippet in your AppKernel class:

if (in_array($this->getEnvironment(), array('dev', 'test'))) {
    $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
    // ...
}

and append your new environment name to the array:

array('dev', 'test', 'dp')
like image 133
Elnur Abdurrakhimov Avatar answered Oct 23 '22 12:10

Elnur Abdurrakhimov


Very simple in Symfony 4. Just add your new environment to the bundles file.

Open config/bundles.php

Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true]

becomes

Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'YOUR_NEW_ENV' => true]
like image 38
Vael Victus Avatar answered Oct 23 '22 12:10

Vael Victus