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

MirazMac's avatar

SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected

TL;DR;

The error on the title occurs randomly, without even any change of the code, and it gets fixed on reload and continues to work 99% of the time.

Long version

Hello good people. I've been recently facing something weird that I just can't figure out the cause of. In my local Laravel setup, where everything works just fine, but randomly it would show this error:

SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected

And after I refresh the page, the error is gone, and won't show again till another random occurrence. And I say the word random very strongly, because it is not associated with anything. Sometimes the error would show twice or once a day, and sometimes never at all. Which is very frustrating because I can't figure out how to recreate the error myself. Because 99% of the time it would just work fine.

Here's the things that I've tried:

  • Clearing cache
  • Re-installing everything via composer
  • Making sure the config files are correct (which they are because they work just fine 99% of the time)

Here's the error from the laravel.log file:

[2021-08-26 20:20:36] local.ERROR: SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (SQL: select `type`, `value` from `options` where `options`.`name` = site_name limit 1) {"exception":"[object] (Illuminate\Database\QueryException(code: 3D000): SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected (SQL: select `type`, `value` from `options` where `options`.`name` = site_name limit 1) at H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:692)
[stacktrace]
#0 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php(652): Illuminate\Database\Connection->runQueryCallback('select `type`, ...', Array, Object(Closure))
#1 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php(360): Illuminate\Database\Connection->run('select `type`, ...', Array, Object(Closure))
#2 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2350): Illuminate\Database\Connection->select('select `type`, ...', Array, true)
#3 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2338): Illuminate\Database\Query\Builder->runSelect()
#4 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2872): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2339): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(602): Illuminate\Database\Query\Builder->get(Array)
#7 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(586): Illuminate\Database\Eloquent\Builder->getModels(Array)
#8 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Concerns\BuildsQueries.php(259): Illuminate\Database\Eloquent\Builder->get(Array)
#9 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(390): Illuminate\Database\Eloquent\Builder->first(Array)
#10 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php(23): Illuminate\Database\Eloquent\Builder->find('site_name', Array)
#11 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1993): Illuminate\Database\Eloquent\Model->forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), 'find', Array)
#12 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2005): Illuminate\Database\Eloquent\Model->__call('find', Array)
#13 H:\wamp64\www\laravel\app\Models\Option.php(70): Illuminate\Database\Eloquent\Model::__callStatic('find', Array)
#14 H:\wamp64\www\laravel\app\Providers\ViewServiceProvider.php(119): App\Models\Option::get('site_name')
#15 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): App\Providers\ViewServiceProvider->boot()
#16 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#17 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#18 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#19 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(651): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#20 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(914): Illuminate\Container\Container->call(Array)
#21 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(895): Illuminate\Foundation\Application->bootProvider(Object(App\Providers\ViewServiceProvider))
#22 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(App\Providers\ViewServiceProvider), 25)
#23 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(896): array_walk(Array, Object(Closure))
#24 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php(17): Illuminate\Foundation\Application->boot()
#25 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(237): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#26 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(152): Illuminate\Foundation\Application->bootstrapWith(Array)
#27 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(136): Illuminate\Foundation\Http\Kernel->bootstrap()
#28 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#29 H:\wamp64\www\laravel\public\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#30 {main}

[previous exception] [object] (PDOException(code: 3D000): SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected at H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php:352)
[stacktrace]
#0 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php(352): PDO->prepare('select `type`, ...')
#1 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php(685): Illuminate\Database\Connection->Illuminate\Database\{closure}('select `type`, ...', Array)
#2 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php(652): Illuminate\Database\Connection->runQueryCallback('select `type`, ...', Array, Object(Closure))
#3 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Connection.php(360): Illuminate\Database\Connection->run('select `type`, ...', Array, Object(Closure))
#4 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2350): Illuminate\Database\Connection->select('select `type`, ...', Array, true)
#5 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2338): Illuminate\Database\Query\Builder->runSelect()
#6 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2872): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#7 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Query\Builder.php(2339): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#8 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(602): Illuminate\Database\Query\Builder->get(Array)
#9 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(586): Illuminate\Database\Eloquent\Builder->getModels(Array)
#10 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Concerns\BuildsQueries.php(259): Illuminate\Database\Eloquent\Builder->get(Array)
#11 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Builder.php(390): Illuminate\Database\Eloquent\Builder->first(Array)
#12 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Support\Traits\ForwardsCalls.php(23): Illuminate\Database\Eloquent\Builder->find('site_name', Array)
#13 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1993): Illuminate\Database\Eloquent\Model->forwardCallTo(Object(Illuminate\Database\Eloquent\Builder), 'find', Array)
#14 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2005): Illuminate\Database\Eloquent\Model->__call('find', Array)
#15 H:\wamp64\www\laravel\app\Models\Option.php(70): Illuminate\Database\Eloquent\Model::__callStatic('find', Array)
#16 H:\wamp64\www\laravel\app\Providers\ViewServiceProvider.php(119): App\Models\Option::get('site_name')
#17 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(36): App\Providers\ViewServiceProvider->boot()
#18 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#19 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#20 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#21 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Container\Container.php(651): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#22 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(914): Illuminate\Container\Container->call(Array)
#23 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(895): Illuminate\Foundation\Application->bootProvider(Object(App\Providers\ViewServiceProvider))
#24 [internal function]: Illuminate\Foundation\Application->Illuminate\Foundation\{closure}(Object(App\Providers\ViewServiceProvider), 25)
#25 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(896): array_walk(Array, Object(Closure))
#26 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\BootProviders.php(17): Illuminate\Foundation\Application->boot()
#27 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(237): Illuminate\Foundation\Bootstrap\BootProviders->bootstrap(Object(Illuminate\Foundation\Application))
#28 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(152): Illuminate\Foundation\Application->bootstrapWith(Array)
#29 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(136): Illuminate\Foundation\Http\Kernel->bootstrap()
#30 H:\wamp64\www\laravel\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php(110): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#31 H:\wamp64\www\laravel\public\index.php(55): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#32 {main}
"}

And this is my config/database.php file:

<?php

use Illuminate\Support\Str;

return [

    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    'default' => env('DB_CONNECTION', 'mysql'),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    'connections' => [

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE'),
            'username' => env('DB_USERNAME', 'root'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => env('DB_TABLE_PREFIX', ''),
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

        'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => env('DB_TABLE_PREFIX', ''),
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],

        'pgsql' => [
            'driver' => 'pgsql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '5432'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => env('DB_TABLE_PREFIX', ''),
            'prefix_indexes' => true,
            'schema' => 'public',
            'sslmode' => 'prefer',
        ],

        'sqlsrv' => [
            'driver' => 'sqlsrv',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', 'localhost'),
            'port' => env('DB_PORT', '1433'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'prefix' => env('DB_TABLE_PREFIX', ''),
            'prefix_indexes' => true,
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Migration Repository Table
    |--------------------------------------------------------------------------
    |
    | This table keeps track of all the migrations that have already run for
    | your application. Using this information, we can determine which of
    | the migrations on disk haven't actually been run in the database.
    |
    */

    'migrations' => 'migrations',

    /*
    |--------------------------------------------------------------------------
    | Redis Databases
    |--------------------------------------------------------------------------
    |
    | Redis is an open source, fast, and advanced key-value store that also
    | provides a richer body of commands than a typical key-value system
    | such as APC or Memcached. Laravel makes it easy to dig right in.
    |
    */

    'redis' => [

        'client' => env('REDIS_CLIENT', 'phpredis'),

        'options' => [
            'cluster' => env('REDIS_CLUSTER', 'redis'),
            'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
        ],

        'default' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_DB', '0'),
        ],

        'cache' => [
            'url' => env('REDIS_URL'),
            'host' => env('REDIS_HOST', '127.0.0.1'),
            'password' => env('REDIS_PASSWORD', null),
            'port' => env('REDIS_PORT', '6379'),
            'database' => env('REDIS_CACHE_DB', '1'),
        ],

    ],

];

Here's my .env file:

APP_NAME="Laravel"
APP_ENV="local"
APP_VERSION=0.1
APP_KEY=base64:mAjzmSO/23GKI2cDEpu5VBGOpN7IbZVgvFMqNDIsnd4=
APP_DEBUG=true
APP_URL=
FILESYSTEM_DRIVER="public"

DB_CONNECTION="mysql"
DB_HOST="127.0.0.1"
DB_PORT="3306"
DB_DATABASE="laravel"
DB_USERNAME="root"
DB_PASSWORD=
DB_TABLE_PREFIX="red_"

SESSION_DRIVER="file"
SESSION_EXPIRE_ON_CLOSE=true

LOG_CHANNEL=stack
LOG_LEVEL=debug
BROADCAST_DRIVER=log

QUEUE_CONNECTION=sync

CACHE_DRIVER="file"

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailhog
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=ap-south-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

Environment

  • PHP 7.4.2
  • MySQL 5.7.14
  • "laravel/framework": "^8.12"
  • WAMP server on Windows 10

Please any context on the issue would be very much appreciated. I don't want anyone facing this randomly on production. Thank you

0 likes
20 replies
MirazMac's avatar

No, I'm not. My changes to config and .env file reflects instantly.

MirazMac's avatar

Thank you, I will try that. But I'm unsure of what it will do, it has something to do it reporting errors when there are missing values? But my app depends on those values. I'm trying to figure out why the issue is occurring and then get it fixed. Can you please explain what will happen if I set it to FALSE?

MirazMac's avatar

Okay, I have set this to FALSE and now let's see if it ever occurs or not. Thank you, hope this solves the issue.

MirazMac's avatar

I can't tell if it it's fixed or not, as it gets fixed normally on reload and won't occur again until randomly. This is the most strange part. Sometimes it happens once or twice a day and sometimes, not at all.

1 like
jlrdw's avatar

Check your mysql logs, is the mysql database loosing connection at times, just suggestion.

MirazMac's avatar

Thanks for the suggestion, but the log file seems empty. In the my.ini file, i have the verbosity set to:

log_error_verbosity=2

If possible let me know if this is enough to log error like the one I'm experiencing.

MirazMac's avatar

I'm lost here, what exactly I should check from here?

jlrdw's avatar

Check with your hosting company, see if it is happening to others as well. Also it might not be a mysql problem, but that's just one thing to check.

If your setup (settings) were wrong, it would constantly happen.

Did you try the:

SHOW GLOBAL STATUS LIKE 'Aborted_connects'

But a next step I'd suggest is get with the hosting tech support. Or if you are getting too many concurrent users, look into scaling up and load balancing.

Edit:

If only happening locally, check the wamp forum, maybe it's something with wamp. I use Xampp or Bitnami, and have not had this issue.

MirazMac's avatar

The project is still not live on any web hosting. I've been developing it on localhost, since last 2 months or so.

Yes, I did try the command. It shows empty results, but then I found out: ** #3167 - The 'INFORMATION_SCHEMA.GLOBAL_STATUS' feature is disabled; see the documentation for 'show_compatibility_56'** so it won't log anything.

Edit: I've been using WAMP for many years, never faced anything like it. I'll give it a try. And I've found a very few people on Stackoverflow facing the exact same problem with Laravel. But unfortunately there weren't any solution. So, I guess it's not related to Laravel.

MirazMac's avatar

I have checked this one and many answers like it, but the issue is these are dealing with raw SQL or manual instance of PDO. But I'm not doing that. I don't have any raw SQL queries. Everything is very basic and done via Eloquent models. Yes, I do have JOIN relationships but they are handled via Eloquent as well. Not to mention, everything just works fine, most of the time,

Another thing I noticed that most of the issues that include this error code were happening because of wrong/invalid DSN in the PDO constructor. But for my case, I'm not creating the constructor, Laravel is doing that internally, I'm only providing the settings via the config/env files. So, there's not much I can do with these stackoverflow answers, unless they are also related to Laravel.

jlrdw's avatar

Even eloquent you have to specify table name in a join, just example:

$quy = Powner::query()->leftJoin('dc_pets', 'dc_powners.ownerid', '=', 'dc_pets.ownerid')
                ->select('dc_powners.ownerid', 'dc_powners.oname')
                ->selectRaw('count(dc_pets.petid) as countOfPets')
                ->groupby('dc_powners.ownerid')
                ->orderby('dc_powners.oname')
                ->get();

See this part

dc_powners.ownerid', '=', 'dc_pets.ownerid')

If you have same field names in two tables for a join, you have to also include table name.

So just double check this kind of thing also. That's why I mentioned that S.O. post, one answer that was the cause.

MirazMac's avatar

Well, thank you, that I know. But I'm not using anything like this. And even if it were something like this, it won't work the other times. I can see it in the log that it fails at the very first query, that only fetches an option value, which is a simple select query without any relations of any kind. And that's where it stops. Off course this can't be the culprit as after a reload it gets fixed automatically and continues to work with literally nothing changed. And won't occur again until randomly.

MirazMac's avatar
MirazMac
OP
Best Answer
Level 1

After a year, I've figured out the cause of the issue. I'm aware this is an old thread but I'm simply providing the solution in case someone in the future stumbles upon the issue again.

The issue is Laravel by default stores the loaded environment values using putenv() / apache_setenv function which is not thread-safe. When there's multiple requests are sent to the server, what happens is the following:

  • 1st request: variables are not there -> load
  • 2nd request: variables are there -> do not load
  • 1st request: ends, cleans up variables
  • 2nd request: use variable -> does not exist anymore, cleaned up by 1st request.

To avoid this while development all you need to do is add the following in Laravel's

bootstrap/app.php

Illuminate\Support\Env::disablePutenv();

(before initializing the app)

And for production no such modification is needed, as generally configs are cached in production.

sfraysse's avatar

You saved my day! Thanks for the feedback. This issue is still valid with Laravel 11.

1 like

Please or to participate in this conversation.