-
Notifications
You must be signed in to change notification settings - Fork 419
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Leaking Dot-Env #605
Comments
This is a known problem with PHP. This is why Laravel has config caching, and doesn't load the env file once config is cached. |
@GrahamCampbell - so if that is the case, do we need to implement |
I wondered this. I'm not opposed to this. Please check with Taylor though. |
In fact, I've already made sir @taylorotwell check it out, please |
@hakuno - this is for Lumen - not for Laravel. Laravel already has a |
@laurencei Yes, I do know. It's only an example about the problem I've got time ago. There I had trouble with APP_KEY for Laravel. But, by now, I have with DB_CONNECTION for Lumen. Ps.: My english speech isn't that good 😛 |
@GrahamCampbell - what exactly is the known problem? Lumen has a check when loading the
Should we perhaps change the default |
I read others threads, and I noticed the problem belongs to the dotenv (not sure?). They say it's not designed for production at all... |
What we mean by that is that it shouldn't be something you run on every request in production. Setup once at deployment, using something like config cache. Should probably clarify the readme. Would accept a PR to do that. |
Do you mean to make a PR to place the config:cache there? How to..? Hm..? I didn't recognize the artisan source or whatever. |
Recent related issue |
Closing since this is really a duplicate of #585. I'm also not sure there's actually anything more to discuss. This issue has been known about for a long time, and a solution has been discussed. |
Description:
It can't find the DB_CONNECTION everytime.
And... Yes! My dot-env is okay. No bothering.
Instead of, my app throws the following exception:
So my AuthServiceProvider fails to retrieve the User model instance.
I would need to reload the page until find it.
The log shows it trying to use MYSQL instead of PGSQL, because it ignores the DB_CONNECTION and loads the default value of Laravel/Lumen.
[2017-04-13 11:47:17] lumen.ERROR: PDOException: could not find driver in C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connectors\Connector.php:68 Stack trace: #0 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connectors\Connector.php(68): PDO->__construct('mysql:host=loca...', 'forge', '', Array) #1 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connectors\Connector.php(43): Illuminate\Database\Connectors\Connector->createPdoConnection('mysql:host=loca...', 'forge', '', Array) #2 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connectors\MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array) #3 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connectors\ConnectionFactory.php(183): Illuminate\Database\Connectors\MySqlConnector->connect(Array) #4 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}() #5 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(882): call_user_func(Object(Closure)) #6 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(903): Illuminate\Database\Connection->getPdo() #7 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(392): Illuminate\Database\Connection->getReadPdo() #8 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(318): Illuminate\Database\Connection->getPdoForSelect(true) #9 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(640): Illuminate\Database\Connection->Illuminate\Database\{closure}('select * from
...', Array)#10 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(607): Illuminate\Database\Connection->runQueryCallback('select * from
...', Array, Object(Closure)) #11 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Connection.php(326): Illuminate\Database\Connection->run('select * from
...', Array, Object(Closure))#12 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Query\Builder.php(1718): Illuminate\Database\Connection->select('select * from
...', Array, true) #13 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Query\Builder.php(1703): Illuminate\Database\Query\Builder->runSelect() #14 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Eloquent\Builder.php(493): Illuminate\Database\Query\Builder->get(Array) #15 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Eloquent\Builder.php(477): Illuminate\Database\Eloquent\Builder->getModels(Array) #16 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Eloquent\Builder.php(409): Illuminate\Database\Eloquent\Builder->get(Array) #17 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Eloquent\Builder.php(284): Illuminate\Database\Eloquent\Builder->first(Array) #18 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Eloquent\Model.php(1316): Illuminate\Database\Eloquent\Builder->find(1) #19 C:\Apache24\htdocs\lirico\vendor\illuminate\database\Eloquent\Model.php(1328): Illuminate\Database\Eloquent\Model->__call('find', Array) #20 C:\Apache24\htdocs\lirico\app\Providers\AuthServiceProvider.php(74): Illuminate\Database\Eloquent\Model::__callStatic('find', Array) #21 [internal function]: App\Providers\AuthServiceProvider->App\Providers\{closure}(Object(Illuminate\Http\Request)) #22 C:\Apache24\htdocs\lirico\vendor\illuminate\auth\RequestGuard.php(54): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #23 C:\Apache24\htdocs\lirico\vendor\illuminate\auth\GuardHelpers.php(49): Illuminate\Auth\RequestGuard->user() #24 C:\Apache24\htdocs\lirico\vendor\illuminate\auth\GuardHelpers.php(59): Illuminate\Auth\RequestGuard->check() #25 C:\Apache24\htdocs\lirico\app\Http\Middleware\Authenticate.php(51): Illuminate\Auth\RequestGuard->guest() #26 C:\Apache24\htdocs\lirico\vendor\illuminate\pipeline\Pipeline.php(148): App\Http\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure)) #27 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request)) #28 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Routing\Pipeline.php(32): call_user_func(Object(Closure), Object(Illuminate\Http\Request)) #29 C:\Apache24\htdocs\lirico\vendor\illuminate\pipeline\Pipeline.php(102): Laravel\Lumen\Routing\Pipeline->Laravel\Lumen\Routing\{closure}(Object(Illuminate\Http\Request)) #30 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(778): Illuminate\Pipeline\Pipeline->then(Object(Closure)) #31 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(624): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure)) #32 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(598): Laravel\Lumen\Application->handleFoundRoute(Array) #33 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(532): Laravel\Lumen\Application->handleDispatcherResponse(Array) #34 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(781): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}() #35 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(534): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure)) #36 C:\Apache24\htdocs\lirico\vendor\laravel\lumen-framework\src\Concerns\RoutesRequests.php(475): Laravel\Lumen\Application->dispatch(NULL) #37 C:\Apache24\htdocs\lirico\public\index.php(28): Laravel\Lumen\Application->run() #38 {main}
Steps To Reproduce:
Request the page
The text was updated successfully, but these errors were encountered: