【发布时间】:2015-08-29 07:39:24
【问题描述】:
我正在关注 Ratchet 的教程。对于 SessionProvider 页面,代码如下:
<?php
// Your shell script
use Ratchet\Session\SessionProvider;
use Symfony\Component\HttpFoundation\Session\Storage\Handler;
use Ratchet\App;
$memcache = new Memcache; // Class not found on line 7
$memcache->connect('localhost', 11211);
$session = new SessionProvider(
new MyApp
, new Handler\MemcacheSessionHandler($memcache)
);
$server = new App('localhost');
$server->route('/sessDemo', $session);
$server->run();
当我在command-line 中运行脚本时,PHP 抛出了一个致命错误:
第 7 行中找不到类 Memcache
这段代码放在bin\chat-server.php中
奇怪的东西
该类不适用于chat-server.php 脚本。
【问题讨论】:
-
您是否有可能在命令行上执行了一个脚本,而另一个通过网络浏览器执行?
-
您确实必须将 memcache 模块添加到 PHP CLI。但是,抱歉,我不知道如何在 Windows/XAMPP 上执行此操作。
-
内存缓存问题仍然存在。它是开放的答案。
-
那么您应该使用有关您的问题的其他信息来更新您的答案。