In my .env
file, I have specified my app environment to be dev and debug to be true like so:
APP_ENV=dev
APP_DEBUG=true
In my config/packages/dev/web_profiler.yaml
file I have the following:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
profiler: { only_exceptions: false }
The routing within config/routes/dev/web_profiler.yaml
seems to be fine:
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt
web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler
So when I run the server with symfony server:start
everything is fine, but the profiler doesn't appear. Did I miss something that enables that feature within Symfony?
To clarify, the page is outputting a proper HTML page with the appropriate content. There is just no profiler showing up.
My base twig template:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>{% block title %} {% endblock %}</title>
{{ encore_entry_script_tags('base') }}
<link rel="icon" type="image/x-icon" href="{{ asset('build/images/favicon.ico') }}" />
<link href="https://fonts.googleapis.com/css?family=IBM+Plex+Sans:400,500|Playfair+Display:400,700&display=swap" rel="stylesheet">
{{ encore_entry_link_tags("base") }}
{% block stylesheet %}{% endblock %}
</head>
<body {% if app.request.get('_route') == 'home' %} class='homepage' {% endif %} >
<header>
<div id='top-navigation' class='padding-lg__left-md padding-lg__right-md padding-lg__top-sm padding-lg__bottom-sm row row__align-center row__justify-start'>
<span class='text-color__white text-size__small text-weight__bold margin-lg__right-lg'>Our Mission</span>
<span class='text-color__white text-size__small text-weight__bold margin-lg__right-lg'>Our Team</span>
<span class='text-color__white text-size__small text-weight__bold margin-lg__right-lg'>Where the Money Goes</span>
<span class='text-color__white text-size__small text-weight__bold margin-lg__right-lg'>Community Leadership</span>
<span class='text-color__white text-size__small text-weight__bold'>Policies</span>
<span class='text-color__white text-size__small text-weight__bold margin-lg__left-auto icon-set'> <span class='icon size__small color__white margin-lg__right-xsm'>{{ source('@public_path'~asset('build/images/icons/feedback.svg')) }}</span>Submit Feedback</span>
</div>
<nav class="padding-lg__top-md padding-lg__bottom-md padding-lg__left-md padding-lg__right-md row row__align-center row__justify-start {% if app.request.get('_route') == 'home' %} homepage {% endif %}">
<div id='logo'>
<a href="{{ url('home') }}">
<img src="{{ asset('build/images/logo_placeholder.png') }}" alt="logo">
</a>
</div>
{% if app.request.get('_route') == 'creator-register' %}
{% else %}
{% if not is_granted('IS_AUTHENTICATED_FULLY') %}
<div class='margin-lg__left-auto'>
<a href="{{ url('login') }}">
<div class='icon-set'>
<span class='icon margin-lg__right-xsm'>
{{ source('@public_path'~asset('build/images/icons/user.svg')) }}
</span>
<span class='nav-item'>Login</span>
</div>
</a>
</div>
{% endif %}
{% endif %}
</nav>
</header>
{% if app.request.get('_route') != 'home' %} <div class='container is_top'> {% endif %}
{% block body %} {% endblock %}
{% if app.request.get('_route') != 'home' %} </div> {% endif %}
</body>
</html>
Security.yaml firewall:
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
anonymous: true
guard:
authenticators:
- App\Security\LoginFormAuthenticator
logout:
path : logout
remember_me:
secret: '%kernel.secret%'
lifetime: 2592000 #<- 30 days in seconds - defaults to one year if you take this out!
Results on php bin/console debug:router | grep _profiler
:
_profiler_home ANY ANY ANY /_profiler/
_profiler_search ANY ANY ANY /_profiler/search
_profiler_search_bar ANY ANY ANY /_profiler/search_bar
_profiler_phpinfo ANY ANY ANY /_profiler/phpinfo
_profiler_search_results ANY ANY ANY /_profiler/{token}/search/results
_profiler_open_file ANY ANY ANY /_profiler/open
_profiler ANY ANY ANY /_profiler/{token}
_profiler_router ANY ANY ANY /_profiler/{token}/router
_profiler_exception ANY ANY ANY /_profiler/{token}/exception
_profiler_exception_css ANY ANY ANY /_profiler/{token}/exception.css
Lastly homepage controller:
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class HomepageController extends AbstractController{
/**
* @Route("/", name="home")
*/
public function output(){
return $this->render('homepage/home.html.twig',[
'title' => 'yo',
]);
}
}
?>
Added public/index.php:
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
require dirname(__DIR__).'/config/bootstrap.php';
if ($_SERVER['APP_DEBUG']) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? $_ENV['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? $_ENV['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
composer require --dev symfony/profiler-pack
– Manquecomposer require profiler —dev
– Angelinaangelinebin/console debug:event-dispatcher kernel.response
where with -128 priority there should be theWebDebugToolbarListener::onKernelResponse
. if it's not, check config/bundles.php, which should contain WebProfilerBundle. yeah. – FiesterWebDebugToolbarListener::onKernelResponse
prevents the toolbar from being injected (usually, the</body>
is replaced (see: github.com/symfony/symfony/blob/…) Sooo ... I would suggest, you add somedd(true)
lines before eachreturn
to see which condition triggers the early return, meaning you go invendor/symfony/web-profiler-bundle/EventListener/WebDebugToolbarListener.php
to debug. or use a debugging tool. – FiesterWebDebugToolbarListener.php
file anddd()
function didn't fire at all in any of the return parts. Maybe that file isn't being called? – Barniedd()
to the one with highest priority) and if none is triggered ... well, that would even be weirder .... and if it triggers, some listener has to be the last working. – Fiesterdd(true);
onSymfony\Component\HttpKernel\EventListener\ResponseListener::onKernelResponse()
and it worked on that (that's the highest priority). – BarnieWebDebugToolbarListener
fails is here on line 102:if (self::DISABLED === $this->mode || !$response->headers->has('X-Debug-Token') || $response->isRedirection() || ($response->headers->has('Content-Type') && false === strpos($response->headers->get('Content-Type'), 'html')) || 'html' !== $request->getRequestFormat() || false !== stripos($response->headers->get('Content-Disposition'), 'attachment;') ) { return; }
– Barniecomposer.json
if all relevant bundles have the same version likesymfony/framework-bundle
. Look forsymfony/twig-bundle
,symfony/yaml
and other bundles fromsymfony
. – Okwutrue
? – PreteritiveX-Debug-Token
- everything else checks out! – Barnie\Symfony\Component\HttpKernel\Profiler\Profiler::collect
is responsible for that. Additionally, it would help if you crafted a reproducable setup for this problem such that others could also see the rest of your configuration – Preteritivephp bin/console debug:router | grep _profiler
– Hermineherminiapublic/index.php
file. By any chance, did you upgrade this project from a previous Symfony version? – Limicolousdie('here');
statement right afterDebug::enable()
on index.php, to verify you are going through there? Also, if you do not ping me, I'm not notified of your replies. – Limicolousdev
env? Can you tryvar_dump($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']);
inindex.php
? – Glossitisdie('here');
gets triggered. – Barniestring(3) "dev" string(1) "1"
– Barniecomposer require profiler --dev
, or something else? – LimicolousWebDebugToolbarListener.php
. On line 109 add this before the return statement:echo 'Mode: ', $this->mode, " XDebTok: ", $response->headers->has('X-Debug-Token'), " IsRedir: ", $response->isRedirection(); die();
and report the return for that. – LimicolousMode: 2 XDebTok: IsRedir:
– Barnie