3

请让我断言:这个问题不是这个的重复

在 Laravel 5 中,我正在尝试安装barryvdh/laravel-debugbar. 但它没有显示。

我做了以下事情:

安装:

composer require barryvdh/laravel-debugbar

将以下行添加到提供程序部分的 config/app.php

'Barryvdh\Debugbar\ServiceProvider',

在外墙列表中..

'Debugbar' => 'Barryvdh\Debugbar\Facade', 我进一步执行:

php artisan vendor:publish --provider="Barryvdh\Debugbar\ServiceProvider"

之后,我尝试了所有问题的答案,以回答我在这个问题开头提到的类似 SO 问题。

就像启用调试一样.env,在 debugbar.php 中启用它,清除配置缓存php artisan config:clear

并再次缓存

php artisan config:cache

还有 .. php artisan view:clear;

但是调试栏不会出现?

可能是什么原因?

4

6 回答 6

5

如果你的 laravel 项目的开发环境使用 Apache 的默认配置作为 web 根目录,请确保AllowOverride All设置为 web 根目录。

<Directory "/var/www/html">
   ...
   AllowOverride All 
   ...
</Directory>

重新启动 Web 服务并尝试重新加载页面。调试栏应该正确显示。

于 2017-08-31T14:56:26.643 回答
4

也许你 ‍‍<code>全部缓存routes在 laravel 中。请清除路由缓存:

PHP artisan route:clear

请参阅以下链接:

启用路由缓存后,调试栏无法渲染

于 2020-10-23T10:24:57.763 回答
0

当我运行以下操作时,我发现调试栏停止工作。

composer install --optimize-autoloader --no-dev

在这种情况下,Debugbar 甚至不会显示APP_ENVislocal或生产以外的任何内容。我相信只有标记APP_ENVlocal足以激活调试栏。

我在这里做了什么,通过执行以下操作。

composer installphp artisan route:cache

于 2021-05-10T07:56:06.960 回答
0

在 Laravel 应用程序根文件夹的 .env 文件中设置 APP_DEBUG=true。

于 2021-01-22T23:27:54.230 回答
0

如果您检查了 github repo 中的所有说明,但调试栏仍然无法正常工作,则问题可能出在您的 NGINX/APACHE 配置中。

就我而言,nginxconf包含以下部分:

location ~ \.php$ {
    fastcgi_pass php-fpm:9000;
    try_files $uri $uri/ index.php /index.php?$args $fastcgi_script_name =404;
    fastcgi_index index.php;
    include /etc/nginx/fastcgi_params;
    include /etc/nginx/fastcgi.conf;
}

您需要将 try files 指令取出到部分:

location / {
    try_files $uri 
    $uri/ index.php /index.php?$args 
    $fastcgi_script_name = 404;
}
于 2021-02-04T23:15:08.740 回答
0

试试这些步骤

composer require barryvdh/laravel-debugbar --dev
php artisan config:cache
php artisan cache:clear
php artisan route:clear
php artisan debugbar:clear
php artisan vendor:publish
composer update
于 2021-10-25T18:10:46.093 回答