找不到Laravel Lumen Memcached [英] Laravel Lumen Memcached not found

查看:192
本文介绍了找不到Laravel Lumen Memcached的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我刚开始使用Lumen,并且尝试使用Auth,但是对Auth :: check或Auth.的任何其他函数的调用会导致以下错误 致命错误:在第52行的vendor \ illuminate \ cache \ MemcachedConnector.php中找不到类'Memcached'. 我不想使用以前从未使用过的Memcached.

Ok, I just started with Lumen and I'm trying to use the Auth, but a call to either Auth::check or any other function of Auth.. leads to the below Error Fatal error: Class 'Memcached' not found in vendor\illuminate\cache\MemcachedConnector.php on line 52. I don't want to use Memcached never used it before.

我在 .env 文件中将其禁用,并将 CACHE_DRIVER SESSION_DRIVER 设置为数组,但仍显示相同的错误.

I disabled it in the .env file and set the CACHE_DRIVER and SESSION_DRIVER to array, but still shows the same error.

我决定不再使用Auth并通过会话/令牌手动处理身份验证,而是将MiddleWare StartSession结果启用为相同的错误.

I decided not to use Auth again and to manually handle my authetication with sessions/tokens, but enabling the MiddleWare StartSession results to the same error.

$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

编辑

深入框架 我在SessionManager类中对会话驱动程序名称进行了硬编码 在方法getSessionConfig

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缺省设置为memecached. env ,然后运行composer dump-autoload ... Lumen:(

It works though but not a good way of doing things. There is no config file, i believe all configurations are written in .env file, but i really don't know why the session_driver and cache_driver is defaulted to memecached even after changing it in the .env and then ran composer dump-autoload ... Lumen :(

编辑 这是我的 .env 文件

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

我的bootsrap/app.php中已经没有注释此行

I already have this line uncommented in my bootsrap/app.php

 Dotenv::load(__DIR__.'/../');

我的数据库配置可正常运行,因此已加载.env文件 很好.

My DataBase configuration works perfectly so the .env file is loaded quite alright.

推荐答案

您可能需要重新启动服务器,尤其是在使用php artisan serve的情况下.

You may need to restart your server, especially if you're using php artisan serve.

流明似乎没有根据每个请求进行.env更改.

Lumen doesn't appear to pick up .env changes per-request.

我遇到了完全相同的问题-尝试使用文件缓存,但是收到有关Memcached的错误-重新启动服务器会重新加载.env文件.

I had exactly the same issue - trying to use file cache, but received errors regarding Memcached - restarting the server reloads the .env file.

这篇关于找不到Laravel Lumen Memcached的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆