Laravel-debugbar: Assets Issue and PhpDebugBar is not defined...

Created on 10 Sep 2017  路  6Comments  路  Source: barryvdh/laravel-debugbar

GET http://localhost/pixelatez/public/_debugbar/assets/stylesheets?v=1505069684
(index):68 GET http://localhost/pixelatez/public/_debugbar/assets/javascript?v=1505069684
(index):70 Uncaught ReferenceError: PhpDebugBar is not defined
at (index):70

These are the errors popping up in my Javascript console. And no logs found in the L5 application

stale

Most helpful comment

Thanks @xJoeyv.
I could fix it now, but it was some other issue:
In my application routes I use the following route that will be used when no other route matched:
Route::get('/{page?}'
So this will direct everything to a controller action I defined.
The DebugBar extension will add more routes by it's service provider. But this is done too late. If I move the adding of routes from the service provider's boot method to it's register method the debug bar will work as it's route have a higher priority than the generic route.

If somebody else has this problem (I think generic routes are a valid use case), you can add the following code at the beginning of your routes.php:
https://gist.github.com/ckdot/e4e393e2709b1b3806bf338f11056666

All 6 comments

Same issue here. Laravel 5.1

@ckdot I fixed it myself, was a bit of fighting with the new Laravel5.5 and its packages.

You need to setup your apache DocumentRoot to the /public folder of your website. This can also be achieved via VirtualHosts. This solved for me all the issues.

Thanks @xJoeyv.
I could fix it now, but it was some other issue:
In my application routes I use the following route that will be used when no other route matched:
Route::get('/{page?}'
So this will direct everything to a controller action I defined.
The DebugBar extension will add more routes by it's service provider. But this is done too late. If I move the adding of routes from the service provider's boot method to it's register method the debug bar will work as it's route have a higher priority than the generic route.

If somebody else has this problem (I think generic routes are a valid use case), you can add the following code at the beginning of your routes.php:
https://gist.github.com/ckdot/e4e393e2709b1b3806bf338f11056666

By default, the server loads the index.html. You need to force the index.php in the browser row.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If this issue is still present on the latest version of this library on supported Laravel versions, please let us know by replying to this issue so we can investigate further.
Thank you for your contribution! Apologies for any delayed response on our side.

@ckdot I fixed it myself, was a bit of fighting with the new Laravel5.5 and its packages.

You need to setup your apache DocumentRoot to the /public folder of your website. This can also be achieved via VirtualHosts. This solved for me all the issues.

I encountered a similar problem GET producing 404 on all resources related to PhpDebugBar.

GET http://localhost/vendor/maximebf/debugbar/src/DebugBar/Resources/widgets.css 404 (Not Found)
GET http://localhost/vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.css net::ERR_ABORTED 404 (Not Found)
etc. etc.

Followed by PhpDebugBar is not defined

My apache config: /public DocumentRoot was correct but /vendor is in a folder at the same level as /public not underneath. As a quick fix I added a symbolic link under /public to the /vendor directory, that fixed it of course. (@xJoeyv 's comment made me see the light - thanks!)

For debugging on a localhost this is an OK solution, but what would be the correct approach on a live server?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hussein-elhussein picture hussein-elhussein  路  3Comments

coderdiaz picture coderdiaz  路  4Comments

innerdev picture innerdev  路  5Comments

ddmo picture ddmo  路  3Comments

linaspasv picture linaspasv  路  5Comments