[英]PHP Ratchet: Class Memcache not found
I am following Ratchet's tutorials. 我正在关注Ratchet的教程。 For SessionProvider page, the code is like this:
对于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();
PHP throws a fatal error when I run the script in the command-line
: 当我在
command-line
运行脚本时,PHP会引发致命错误:
Class Memcache not found in on line 7
在第7行上找不到类Memcache
This code is placed in bin\\chat-server.php 此代码位于bin \\ chat-server.php中
The class is not available only for chat-server.php
script. 该类仅对
chat-server.php
脚本不可用。
There are two distinct PHP extensions for the service memcached
: 服务
memcached
有两个不同的 PHP扩展:
memcache
memcached
<-- note the d
memcached
<-注意d
Looks like you have installed the latter one, while you need the first one for your application. 看起来您已经安装了后者,而您的应用程序则需要第一个。
You can find the right extension for Windows here 您可以在此处找到适用于Windows的正确扩展名
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.