Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

darkec's avatar

debug = false is not working

I set my .env as follows:

APP_ENV=production
APP_DEBUG=false
APP_LOG_LEVEL=info

But it stills shows me debug messages and trace in API. Why is that?

0 likes
18 replies
Snapey's avatar

are these entries in config/app.php stock or have you edited them?

darkec's avatar

they are from .env config/app.php is left as it is during installation (it's taking all values from .env file)

squibby's avatar

use php artisan config:clear

This will clear the cached variables and use the new ones.

1 like
squibby's avatar

try php artisan config:cache

that should clear and then recache.

2 likes
darkec's avatar

Still not working this is what I get. This "debug" part is killing me

{
  "error": {
    "message": "Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ']'",
    "status_code": 500,
    "debug": {
      "line": 103,
      "file": "E:\\xampp\\htdocs\\app\\Api\\V1\\Controllers\\Messages\\MessageController.php",
      "class": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",
      "trace": [
        "#0 E:\\xampp\\htdocs\\vendor\\composer\\ClassLoader.php(322): Composer\\Autoload\\includeFile('E:\\\\xampp\\\\htdocs...')",
        "#1 [internal function]: Composer\\Autoload\\ClassLoader->loadClass('App\\\\Api\\\\V1\\\\Cont...')",
        "#2 [internal function]: spl_autoload_call('App\\\\Api\\\\V1\\\\Cont...')",
      ]
    }
  }
}
al0mie's avatar

If php artisan config:cache still not working, simple try to restart your server. Maybe you should try to change that variable manual in app.php.

squibby's avatar

Are you running on Homestead? If so destroy the box and re-provision.

johnnrr's avatar

Are you still having that trouble after 3 years? I am on Laravel 7.x and have the same problem. Only thing that works for me is to edit the \config\app.php.

Change 'debug' => env('APP_DEBUG', false), to 'debug'=false, and then in console type

'php artisan config:cache'.

If anyone have solutions to make the .env working, I am happy.

Snapey's avatar

it works perfectly as it is.

don't cache config in development. use config:clear instead @johnnrr

1 like
successdav's avatar

I hit this error and I tried everything from the top to this very reply by @snapey. Why was it not the first reply?

The solution is to run config: clear nothing else.

php artisan config:clear

mzamirani's avatar

I used Laravel 9 and have the same issue. And "php artisan config:clear" does not help.

Sinnbeck's avatar

@mzamirani Please make a new thread so we can try helping you out. Chances are that the original poster, does not have the same issue 5 years later

1 like
mzamirani's avatar

sorry, but I can't. After writing all (Title + tekst) get : You have ventured into 404 space. (Page Not Found)

Sinnbeck's avatar

@mzamirani Try just making a new one but only add a test text ? You can edit it afterwards

Please or to participate in this conversation.