I set debug mode to true
in config->app and deployed it on the server:
'debug' => env('APP_DEBUG', true),
I have following code in Controller to check the mode:
...
$debug = config('app.debug');
var_dump($debug);
$product->save();
Result on local machine:
C:\xampp\htdocs\MK\app\Http\Controllers\ProductController.php:45:boolean true
Result on the server:
bool(false) Whoops, looks like something went wrong.
Why isn't debug mode set on server side?
Enable or disable debug mode using app. Open the app. php file located in your config/app. php laravel project. Search for debug key and change true to enable debug mode and false for disabling debug mode default it will show false.
The Debugbar will start working inmediately if the debug mode is turned on: To do it so, you just need to modify in your config/app. php or . env file the debug_mode to true. If you wish to use the dump methods in the debugbar console, you need to include the alias to your /config/app.
Through your config/app. php , set 'debug' => env('APP_DEBUG', false), to true . Or in a better way, check out your . env file and make sure to set the debug element to true.
This line in your config file, 'debug' => env('APP_DEBUG', true)
, may be the cause of your issue.
It is saying; set debug
to the value defined in my .env
file, and if there is none then use true
.
As such it is looking at APP_DEBUG=false
in your .env
file, even though you have set the second parameter to true.
Try updating the setting in your .env
file to true.
First of all the debug mode need to be activated! And the APP_ENV
need to be set to local.
Now how to do that! We need to check in multiple places
APP_ENV=local
APP_DEBUG=true
Make sure they are not set twice! You can Uncomment with # APP_ENV=production
(using #
).
Too importantly you need to change APP_ENV
to local
.
And to check, you can run
php artisan env
You get something like:
Next thing to check is config/app.php
Know that the .env
is processed by this file! And that file is where the config is managed!
Check that the config line is not removed or commented!
(depending if it's a new install or some already worked on project)
Depending on what version of Laravel you are using! It may be slightly different!
But the point is to make sure that the .env config is loaded or it will default to true!
'debug' => env('APP_DEBUG', true) // second param the default value
In our current project! The setting were as bellow:
'debug' => (function_exists('env')) ? env('APP_DEBUG', true) : true,
it check if env exists! if yes it use it ! If not it will set the default value directly!
My teammate! Didn't notice that! And he got an error! Becaues somebody before us have changed it as bellow (and was commented):
The image is added to illustrate how a mistake can be made! Also for navigation clearance!
Bottom line check it out and make sure it's all right! (if all right then just move to the next section)
Yea to be expected !
Importantly you should know that you may need to clear the cache
Run
php artisan view:clear
and
php artisan cache:clear
After that it should work!
You may have file system permission problems!
Check this out
https://stackoverflow.com/a/28063794/7668448
Laravel beautiful debug screen ❤️
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With