Rafat Hossain
Rafat Hossain

Reputation: 139

How to remove the environment variables from Laravel Debug?

I want to remove the environment variables, database details and the information showing on Laravel Debug.

Upvotes: 4

Views: 5540

Answers (5)

Jaber Al Nahian
Jaber Al Nahian

Reputation: 1061

This is from my config/app file:

'debug_blacklist' => [
        '_ENV' => [
            'APP_KEY',
            'DB_DATABASE',
            'DB_PASSWORD',
            'DB_USERNAME',
            'REDIS_PASSWORD',
            'MAIL_PASSWORD',
            'PUSHER_APP_KEY',
            'PUSHER_APP_SECRET',
        ],
        '_SERVER' => [
            'APP_KEY',
            'DB_DATABASE',
            'DB_PASSWORD',
            'DB_USERNAME',
            'REDIS_PASSWORD',
            'MAIL_PASSWORD',
            'PUSHER_APP_KEY',
            'PUSHER_APP_SECRET',
        ],
        '_POST' => [
            'password',
        ],
    ],

Add this array to our config/app file, the the system will replace real values with ***.

enter image description here

This way is useful if you want control on specific key items.

Upvotes: 6

Sodruldeen Mustapha
Sodruldeen Mustapha

Reputation: 1271

Go to config/app and add the following

 /**
 * Debug Blacklist
 */
'debug_blacklist' => [
    '_COOKIE' => array_keys($_COOKIE),
    '_SERVER' => array_keys($_SERVER),
    '_ENV' => array_keys($_ENV),        
],

it will replace all environment variables value with an asterisks (*******)

Upvotes: 23

zahidul Islam
zahidul Islam

Reputation: 84

Go to your project file: open .env file in notepad and find out APP_DEBUGAPP_DEBUG=true you just rename false; and save. your problem is solve.

Upvotes: -2

JoshGray
JoshGray

Reputation: 95

Change from APP_DEBUG=true to APP_DEBUG=false in the .env file. Then you can rely on the laravel logs for your errors. (yourLarvelApp/storage/logs)

Upvotes: -2

Erkan Özkök
Erkan Özkök

Reputation: 891

You can make your own error pages. (official documentation)

Make a blade file for 500 errors. (resources/views/errors/500.blade.php)

And print error messages or trace log

<h2>{{ $exception->getMessage() }}</h2>

Upvotes: 0

Related Questions