title: Symfony 4 : An error occurred while loading the web debug toolbar
body: <p>I work on CentOS.</p>
  
  <p>I've followed the tutorials : </p>
  
  <ul>
  <li><p><a href="http://symfony.com/doc/current/best_practices/creating-the-project.html" rel="noreferrer">http://symfony.com/doc/current/best_practices/creating-the-project.html</a></p></li>
  <li><p><a href="https://symfony.com/doc/current/page_creation.html" rel="noreferrer">https://symfony.com/doc/current/page_creation.html</a></p></li>
  </ul>
  
  <p>As I use Apache, I've followed this page too :</p>
  
  <ul>
  <li><a href="https://symfony.com/doc/current/setup/web_server_configuration.html" rel="noreferrer">https://symfony.com/doc/current/setup/web_server_configuration.html</a></li>
  </ul>
  
  <p>I made a default controller and a default template. With this controller (/) I get the the following error (within the debug toolbar):</p>
  
  <pre><code>An error occurred while loading the web debug toolbar. Open the web profiler.
  </code></pre>
  
  <p>When I click on the link : "Open the web profiler", I can see the Apache response :</p>
  
  <pre><code>Not Found
  The requested URL /_profiler/177403 was not found on this server.
  </code></pre>
  
  <p>In the chrome inspector, I can see :
  GET <a href="http://172.31.18.7/_wdt/177403" rel="noreferrer">http://172.31.18.7/_wdt/177403</a> 404 (Not Found)</p>
  
  <p>Here's the interesting part of my composer.json :</p>
  
  <pre><code>    "require": {
          "php": "^7.1.3",
          "ext-iconv": "*",
          "doctrine/doctrine-fixtures-bundle": "^3.0",
          "sensio/framework-extra-bundle": "^5.1",
          "sonata-project/admin-bundle": "^3.35",
          "sonata-project/doctrine-orm-admin-bundle": "^3.6",
          "symfony/apache-pack": "^1.0",
          "symfony/console": "^4.0",
          "symfony/flex": "^1.0",
          "symfony/framework-bundle": "^4.0",
          "symfony/lts": "^4@dev",
          "symfony/maker-bundle": "^1.4",
          "symfony/orm-pack": "^1.0",
          "symfony/requirements-checker": "^1.1",
          "symfony/security-bundle": "^4.0",
          "symfony/twig-bundle": "^4.0",
          "symfony/validator": "^4.0",
          "symfony/yaml": "^4.0"
      },
      "require-dev": {
          "sensiolabs/security-checker": "^4.1",
          "symfony/dotenv": "^4.0",
          "symfony/web-profiler-bundle": "^4.0"
      },
  </code></pre>
  
  <p>my httpd.conf :</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
  DocumentRoot /var/www/html/elora/public
  ServerName eloradev
  ServerAlias www.elora.dev
  DirectoryIndex index.php
  
  &lt;Directory "elora/public"&gt;
      AllowOverride all
      Order Allow,Deny
      Deny from all
      Allow from 127.0.0.1
      Allow from ::1
      Allow from localhost
  &lt;/Directory&gt;
  
  &lt;Directory elora&gt;
      Options FollowSymlinks
  &lt;/Directory&gt;    
  
  ErrorLog /var/apache/logs/error.log
  CustomLog /var/apache/logs/access.log combined  
  
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>And my .htaccess :</p>
  
  <pre><code>DirectoryIndex index.php
  
  &lt;IfModule mod_negotiation.c&gt;
      Options -MultiViews
  &lt;/IfModule&gt;
  
  &lt;IfModule mod_rewrite.c&gt;
      RewriteEngine On
  
      RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
      RewriteRule ^(.*) - [E=BASE:%1]
  
      RewriteCond %{HTTP:Authorization} .
      RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  
      RewriteCond %{ENV:REDIRECT_STATUS} ^$
      RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
  
      RewriteCond %{REQUEST_FILENAME} -f
      RewriteRule ^ - [L]
  
      RewriteRule ^ %{ENV:BASE}/index.php [L]
  &lt;/IfModule&gt;
  
  &lt;IfModule !mod_rewrite.c&gt;
      &lt;IfModule mod_alias.c&gt;
          RedirectMatch 307 ^/$ /index.php/
      &lt;/IfModule&gt;
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>And, to finish, my /lucky/number (<a href="https://symfony.com/doc/current/page_creation.html" rel="noreferrer">https://symfony.com/doc/current/page_creation.html</a>) raises the apache message : </p>
  
  <pre><code>Not Found
  The requested URL /lucky/number was not found on this server.
  </code></pre>
  
  <p>It looks like the routing component does'nt work.</p>
  
  <p>The router rules (debug:router) :</p>
  
  <pre><code>-------------------------- -------- -------- ------ -------------------
  Name                       Method   Scheme   Host   Path
  -------------------------- -------- -------- ------ ----------------------- 
    app_homepage               ANY      ANY      ANY    /
    app_lucky                  ANY      ANY      ANY    /lucky
    app_lucky_number           ANY      ANY      ANY    /lucky/number
    _twig_error_test           ANY      ANY      ANY    /_error/{code}.{_format}
    _wdt                       ANY      ANY      ANY    /_wdt/{token}
    _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
   -------------------------- -------- -------- ------ -----------------------
  </code></pre>
  
  <p>I've manually created the directory /_wdt, in case, but it did'nt change anything.</p>
  
  <p>I've checked errors with debug:event-dispatcher, nothing special.</p>
  
  <p>I've noticed that the cache for the profiler is in that directory : var/cache/dev/profiler/03/74/ and is named 177403</p>
  
  <p>One more thing, I've ran composer with the 'root' user. And I've used chown to change the owner of my project.</p>
  
  <p>Here's a part of my file .env :</p>
  
  <pre><code>###&gt; symfony/framework-bundle ###
  APP_ENV=dev
  </code></pre>