9

Please let me assert: This question is not a duplicate of this,

In Laravel 5 I am trying to install barryvdh/laravel-debugbar. but it is not showing.

I did the following:

Installation:

composer require barryvdh/laravel-debugbar

Added the following lines to the config/app.php in the providers section

'Barryvdh\Debugbar\ServiceProvider',

And in the facades list..

'Debugbar' => 'Barryvdh\Debugbar\Facade', Further I execute:

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

After that I tried everything in answers to a similar SO question I mentioned at the beginning of this question.

Like enabling debug in .env, enable it in the debugbar.php, clearing config cache with php artisan config:clear

and caching again with

php artisan config:cache

also .. php artisan view:clear;

But the debug bar won't appear?

What could be the reasons?

8
  • Check your APP_ENV if it is local. Production might be causing the issue. Commented Jun 26, 2017 at 15:14
  • What did you set your environment to in the .env? Commented Jun 26, 2017 at 15:14
  • some time due to autoload files. Have you tried sudo composer dumpautoload ? Commented Jun 26, 2017 at 15:17
  • app environment is local in .env Commented Jun 26, 2017 at 15:19
  • @SagarGautam, though I did a sudo composer dumpautoload, and it did not work, your suggestion was not very good.. It gave a warning not to run composer with root permissions.. Commented Jun 26, 2017 at 15:21

11 Answers 11

11

maybe you ‍‍cache all routes in laravel. please clear route cache:

PHP artisan route:clear

please see the below link:

When route caching is enabled, the debugbar fails to render

Sign up to request clarification or add additional context in comments.

Comments

5

If the dev environment of your laravel project is using the default configuration of Apache for web root directory, make sure the AllowOverride All is set for the web root directory.

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

Restart web service and try reloading the page. The debug bar should be showing up properly.

1 Comment

for my case bar appears on 404 pages only but not showing on other pages.
2

In my situation, there was an issue with the creation permissions for the debugbar directory, which was resolved by creating and granting the appropriate permissions to this directory.

in your project directory run:

mkdir storage/debugbar
chmod -R 777 storage/debugbar 

Comments

1

I found the debugbar stopped working when I ran following.

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

In this case, the Debugbar wont show even the APP_ENV is local or anything other than production. I believe only marking APP_ENV as local is enough to activate debugbar.

What I did here, by executing following.

composer install and php artisan route:cache

1 Comment

If you installed it as a dev dependency in composer, then it makes sense that --no-dev would remove the dependency
1

For me, with my version of debugbar ("^3.7"), I need create directory in in the root of the Laravel storage directory named debugbar.

The library won't create the debugbar directory automatically.

When I create this directory, it works!

This is because Debugbar saves your logs and caches in this folder.

1 Comment

Sure! My version of debugbar is "^3.7". In Storage directory you need create a directory called "debugbar", in root of Storage, because debugbar save your logs and caches in this folder.
0

Set APP_DEBUG=true in .env file in the root folder of the Laravel application.

Comments

0

If you checked all instructions in the github repo and the debugbar is still not working, the problem may be in your NGINX/APACHE configuration.

In my case, nginx conf сontained the section:

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;
}

You need to take out the try files directive to section:

location / {
    try_files $uri 
    $uri/ index.php /index.php?$args 
    $fastcgi_script_name = 404;
}

Comments

0

Try these steps

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

Comments

0
  1. Make sure that app environment is set to local:
APP_ENV=local
  1. Make sure that app debug is enabled:
APP_DEBUG=true
  1. Make sure that debugbar is enabled:
DEBUGBAR_ENABLED=true
  1. Make sure to run the following commands:
php artisan cache:clear
php artisan config:cache
php artisan debugbar:clear

Comments

0

The issue was that we were returning an array instead of a string or a blade file. See here for barryvdh's (package owner) comment regarding this.

return [
  'data' => 'test',
];

You can either just return a string see here

return 'ok'

or a blade file.

return view(debugbar);

Comments

0

One more case:

If you install your laravel not in the root, but in subfolder, e.g. subfolder

Modify in config/debugbar.php (better to use APP_DIR in .env):

'route_prefix' => env('APP_DIR') . '/_debugbar',

and then do

php artisan cache:clear; php artisan route:clear; php artisan config:clear; php artisan view:clear

Work for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.