【问题标题】:Symfony 4 - An error occurred while loading the web debug toolbarSymfony 4 - 加载 Web 调试工具栏时出错
【发布时间】:2019-04-15 14:40:48
【问题描述】:

我在 Linux Mint(基于 Ubuntu 18.04)、apache2 和 php 7.2 下工作

当我生成 Symfony 3 项目时,会生成工具栏,但在 Symfony 4.2.5 中,即使使用 fersh 安装,调试工具栏也不会显示。

我尝试了这个解决方案:

composer require symfony/apache-pack
chmod -R 777 var/cache

[sudo] a2enmod rewrite
[sudo] service apache2 restart

并更改了我的 .htaccess :

DirectoryIndex index.php

<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

<IfModule mod_rewrite.c>
    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]
</IfModule>

<IfModule !mod_rewrite.c>
    <IfModule mod_alias.c>
        RedirectMatch 307 ^/$ /index.php/
    </IfModule>
</IfModule>

但我仍然在页面末尾收到与工具栏相同的消息:

加载 Web 调试工具栏时出错。

【问题讨论】:

  • 我什么都没改,今天工具栏又回来了!
  • 嗨@zied-alaya,我不得不更改 composer.json 文件中的几行代码。请参阅我的评论以获取更多信息:stackoverflow.com/questions/56432536/…

标签: php symfony4


【解决方案1】:

我在 Windows 下工作,我遇到了类似的问题,在我的情况下,.htaccess 文件在安装 apache-pack 之后或之前不存在于公用文件夹中,即使在安装探查器之后也是如此,所以我只是复制/粘贴来自另一个站点的 htaccess 代码,例如 https://ourcodeworld.com/articles/read/793/how-to-configure-a-virtualhost-in-xampp-3-3-2-for-a-symfony-4-project ...希望对您有所帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-09-30
    • 2014-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-25
    相关资源
    最近更新 更多