I have two Laravel APIs that are serving an AngularJS app all on my local development machine. I'm getting a weird issue when the Angular page calls POSTs to both APIs where it seems to be using the wrong database name (it's using the other Laravel's instance's database). Laravel throws an exception that says Table database.table
not found, where database is the incorrect database. I've tried calling each of the APIs using Postman and that works fine, and I'm sure there is no mention of the other database in either project.
To me this seems like a caching issue, where the .env file might be cached and shared between the two Laravel servers for some reason. Both of the Laravel apps are hosted on Apache. I've tried calling php artisan config:clear
and have set the appropriate headers in the .htaccess files to try to prevent any caching but neither of those worked. I have also tried on multiple browsers, cleared the cache, and still the same error.
I want to be able to use the .env file so that I can have a unique configuration for my development server so I'd rather not hardcode the database credentials in config/database.php
. Any ideas what could be the issue?
Both database.php files look like:
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST'),
'database' => env('DB_DATABASE'),
'username' => env('DB_USERNAME'),
'password' => env('DB_PASSWORD'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
],
Where the unique settings are stored in .env
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire