即使在生产环境中,Symfony 调试器仍然启用
Symfony debugger is still enabled even on production
我对这种行为感到很困惑。
我将我的环境设置为生产环境,调试器在生产环境中仍然可用。
我的.env文件是这样的
APP_ENV=production
这是我的捆绑包配置。
<?php
$bundles = [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class => ['all' => true],
];
if ('dev' === $_SERVER['APP_ENV']) {
$devBundles = [
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true]
];
return array_merge($bundles, $devBundles);
}
return $bundles;
有谁知道为什么我的 Debug 仍在 prod 上运行?
例如:
http:///localhost/asd/
Returns Symfony 输出错误..
ResourceNotFoundException NotFoundHttpException
HTTP 404 Not Found
No route found for "GET /asd/"
感谢任何帮助。
编辑:我不确定这是否有帮助,但这是我发现的。
如果我将 APP_EVN
设置为 dev
我的 WebProfilerBundle 正在加载,如果我将它设置为 production
,它不会加载。
默认生产环境称为prod
。所以你必须把它改成:
APP_ENV=prod
我对这种行为感到很困惑。 我将我的环境设置为生产环境,调试器在生产环境中仍然可用。
我的.env文件是这样的
APP_ENV=production
这是我的捆绑包配置。
<?php
$bundles = [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
EightPoints\Bundle\GuzzleBundle\EightPointsGuzzleBundle::class => ['all' => true],
];
if ('dev' === $_SERVER['APP_ENV']) {
$devBundles = [
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true]
];
return array_merge($bundles, $devBundles);
}
return $bundles;
有谁知道为什么我的 Debug 仍在 prod 上运行?
例如:
http:///localhost/asd/
Returns Symfony 输出错误..
ResourceNotFoundException NotFoundHttpException HTTP 404 Not Found No route found for "GET /asd/"
感谢任何帮助。
编辑:我不确定这是否有帮助,但这是我发现的。
如果我将 APP_EVN
设置为 dev
我的 WebProfilerBundle 正在加载,如果我将它设置为 production
,它不会加载。
默认生产环境称为prod
。所以你必须把它改成:
APP_ENV=prod