我是Magento的新手,我的服务器的默认php会话处理程序是memcached。我刚刚安装了Magento(版本2)并且我一直收到错误:
open(localhost:11211/sess_qmnpedun2j0ie0jed9g8r08pd0, O_RDWR) failed: No such file or directory
它正在尝试使用File Handler进行Memcached会话。我应该如何在Magento中更改它? Google-ing一直告诉我转到local.xml并添加以下内容:
<session_save><![CDATA[memcached]]></session_save>
<session_save_path><![CDATA[tcp://localhost:11211?persistent=1&weight=2&timeout=10&retry_interval=10]]></session_save_path>
但问题是,我没有MAGENTO_DIR/app/etc/local.xml
,所以我真的不知道该怎么做。
我通过github页面(命令行安装)中给出的链接安装了Magento2。安装成功,数据库和所有内容都已创建。
如何更改会话处理程序以在Magento-2中使用memcached?
答案 0 :(得分:3)
这是因为在Magento2中local.xml
不再存在,被替换为config.php
而config.php
位于.gitignore
中(因此您在GitHub中看不到它) !)。
Here您可以找到有关创建config.php文件的说明。在细分细节下的页面底部,您可以看到如何定义个人配置。
here您可以在Magento2中找到config.php
文件的示例。
例如,关于您的情况,您需要将此结构添加到config.php
文件中:
__/session
|__/save
|-- <files|db>
所以我猜你最终需要在config.php中添加这样的东西:
'session' =>
array (
'save' => 'memcache',
'save_path' => 'tcp://localhost:11211?persistent=1&weight=2&timeout=10&retry_interval=10'
),
不要忘记调整路径(服务器和端口)以匹配您的环境。
答案 1 :(得分:0)
在magento 2.3.0中删除了对内存缓存的支持。
我创建了plugin,该会话允许使用内存缓存进行会话。
可在此处找到文档:https://connect20.aveo-trade.cz/docs/user-guide-memcached-2.3.0.pdf