Ramesh Pareek
Ramesh Pareek

Reputation: 1669

barryvdh/laravel-debugbar does not appear in laravel

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?

Upvotes: 8

Views: 14470

Answers (10)

Elena S
Elena S

Reputation: 31

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.

Upvotes: 0

shmuels
shmuels

Reputation: 1393

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

Upvotes: 0

Kibo
Kibo

Reputation: 888

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 

Upvotes: 2

hsul4n
hsul4n

Reputation: 519

  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

Upvotes: 0

Akashxolotl
Akashxolotl

Reputation: 566

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

Upvotes: 0

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

Upvotes: 1

Vladislav L
Vladislav L

Reputation: 1

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

Upvotes: 0

user2007270
user2007270

Reputation: 43

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

Upvotes: 0

Mostafa Norzade
Mostafa Norzade

Reputation: 1766

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

Upvotes: 11

ojikobeshi
ojikobeshi

Reputation: 124

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.

Upvotes: 5

Related Questions