0

I'm unable to use the symfony profiler after running composer req profiler I'm using symfony/skeleton in version 4.0 beta, but i remember having the same problem when i tested it a few months ago in 3.3.

The toolbar isn't working, message here :

An error occurred while loading the web debug toolbar. Open the web profiler.

And when click on "open the web profiler", i have a 404 error.

If someone resolved it, thank you for your help. If not, I'll report a bug while this is still in bêta.

About installation : created a project with composer, with the symfony/skeleton package in version 4.0-beta linked here : https://github.com/symfony/skeleton

My php version is 7.1 ; i try to install profiler from the command above.

Artandor
  • 472
  • 6
  • 20
  • How did you setup install your project? I just made a new S4 beta project and it all seemed to work as expected. Did you add a controller page? Consider updating your question with the details of your project installation. – Cerad Oct 24 '17 at 20:07
  • updated project install – Artandor Oct 24 '17 at 22:13

3 Answers3

3

OP fixed his issue already, but I thought I'd comment on my experience. In my case, I used Flex to install the profiler just fine; checking out my app, routes were set correctly. I followed Symfony's guide to webserver configuration for Apache and PHP-FPM, which worked great for getting PHP files running. However, the section on rewrite rules for non-PHP files is in the mod_php section and not repeated in the FPM section. I missed this while reading through quickly. Specifically, you need to ensure you have the mod_rewrite block in your configuration as follows (use either the Apache 2.2 or 2.4 setting, not both):

DocumentRoot /var/www/project/public
<Directory /var/www/project/public>
    AllowOverride None

    # Apache 2.2
    Order Allow,Deny
    Allow from All
    # /Apache 2.2

    # Apache 2.4
    Require all granted
    # /Apache 2.4

    <IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
    </IfModule>
</Directory>
Nate
  • 209
  • 3
  • 7
1

I just had the same issue. I installed it using composer require profiler --dev

then I installed twig cause I wanted to return a view instead of Response object, but the profiler didn't work.

the reason was that I've created a Twig template that isn't extending base.html.twig that is just a simple html layout that has the html,body,head, and title tags.

so it turns out that the profiler needs the body tag within the markup Response you are returning.

so, all i did was adding {% extends 'base.html.twig' %} in the top of my new template.

and it worked!

0

Try following these steps:

composer create-project -s beta symfony/skeleton:4.0.x s40b1
cd s40b1
composer require web-server
composer require cli
composer require profiler

Add a controller

class DemoController extends AbstractController
{
    public function demoAction()
    {
        $html = <<<EOT
<!DOCTYPE html>
<html>
  <head><meta charset="UTF-8"><title>s4b1</title></head>
  <body>Demo Body</body>
</html>
EOT;
        return new Response($html);
    }
}

And a route

demo:
    path: /demo
    defaults: { _controller: 'App\Controller\DemoController::demoAction' }

Then

bin/console cache:clear
bin/console server:run

Navigate to

http://127.0.0.1:8000/demo

If it works then determine where your config is different.

Cerad
  • 48,157
  • 8
  • 90
  • 92