好的,我刚开始使用Lumen,我正在try 使用Auth,但是调用Auth::Check或Auth的任何其他函数.导致以下错误 Fatal error: Class 'Memcached' not found in vendor\illuminate\cache\MemcachedConnector.php on line 52美元. 我不想使用memcached,以前从未使用过它.
I disabled it in the .env file and set the CACHE_DRIVER and SESSION_DRIVER to array, but still shows the same error.
我决定不再使用Auth,而是手动处理会话/令牌的身份验证,但启用中间件StartSession会导致相同的错误.
$app->middleware([
// 'Illuminate\Cookie\Middleware\EncryptCookies',
// 'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession',
// 'Illuminate\View\Middleware\ShareErrorsFromSession',
// 'Laravel\Lumen\Http\Middleware\VerifyCsrfToken',
]);
Please I'd be so glad if anyone can really help me out here
EDIT
After going A little Deep in the framework
I Hard Coded the session driver name in the SessionManager
Class
within the method getSessionConfig
public function getSessionConfig()
{
$this->setDefaultDriver("cookie");//I added this line
return $this->app['config']['session'];
}
不过,这很管用,但不是一种好的做事方式.
没有配置文件,我相信所有的配置都是写在.env文件中的,但是我真的不知道为什么SESSION_DRIVER和CACHE_Driver在.env中更改后都默认为memecached,然后运行composer dump-autoload
.Lumen :(
EDIT This is my .env file
APP_ENV=local
APP_DEBUG=true
APP_KEY=SomeRandomKey!!!
APP_LOCALE=en
APP_FALLBACK_LOCALE=en
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=test
DB_USERNAME=root
DB_PASSWORD=
CACHE_DRIVER=array
SESSION_DRIVER=cookie
QUEUE_DRIVER=database
I already have this line uncommented in my bootsrap/app.php
Dotenv::load(__DIR__.'/../');
我的数据库配置运行良好,因此.env文件已加载