Symfony 2.6:仅当未设置 xdebug cookie 时才加载 Web 调试工具栏时出错
Symfony 2.6: Error loading web debug toolbar only when xdebug cookie not set
每当我 运行 在我的站点上设置了 xdebug cookie 的页面时,我都能正常看到 Web 调试工具栏。但是,如果我在浏览器中禁用该 cookie 并尝试 运行 同一页面,我会收到以下错误:
An error occurred while loading the web debug toolbar (404: Not Found)
如何在没有 xdebug 的情况下使用 Web 调试工具栏?
更新:这是我的 app_dev.php 文件。这适用于其他服务器,但出于某种原因不适用于此服务器:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '74.80.8.75', '192.168.56.1'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.' . $_SERVER['REMOTE_ADDR']);
}
if (!isset($_COOKIE['XDEBUG_SESSION'])) {
$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
} else {
$loader = require_once __DIR__ . '/../app/autoload.php';
}
Debug::enable();
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
if (!isset($_COOKIE['XDEBUG_SESSION'])) {
$kernel->loadClassCache();
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
编辑2:
无论是否在主页路由上使用 cookie,它实际上都可以正常工作。但是,如果我使用不同的路由,例如 app_dev.php/my-route/,那么它只适用于 XDEBUG cookie 集。
原来这是PHP 运行 内存不足造成的。增加 memory_limit 修复了它。
每当我 运行 在我的站点上设置了 xdebug cookie 的页面时,我都能正常看到 Web 调试工具栏。但是,如果我在浏览器中禁用该 cookie 并尝试 运行 同一页面,我会收到以下错误:
An error occurred while loading the web debug toolbar (404: Not Found)
如何在没有 xdebug 的情况下使用 Web 调试工具栏?
更新:这是我的 app_dev.php 文件。这适用于其他服务器,但出于某种原因不适用于此服务器:
if (isset($_SERVER['HTTP_CLIENT_IP'])
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|| !in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '74.80.8.75', '192.168.56.1'))
) {
header('HTTP/1.0 403 Forbidden');
exit('You are not allowed to access this file. Check ' . basename(__FILE__) . ' for more information.' . $_SERVER['REMOTE_ADDR']);
}
if (!isset($_COOKIE['XDEBUG_SESSION'])) {
$loader = require_once __DIR__ . '/../app/bootstrap.php.cache';
} else {
$loader = require_once __DIR__ . '/../app/autoload.php';
}
Debug::enable();
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
if (!isset($_COOKIE['XDEBUG_SESSION'])) {
$kernel->loadClassCache();
}
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
编辑2:
无论是否在主页路由上使用 cookie,它实际上都可以正常工作。但是,如果我使用不同的路由,例如 app_dev.php/my-route/,那么它只适用于 XDEBUG cookie 集。
原来这是PHP 运行 内存不足造成的。增加 memory_limit 修复了它。