PHP 棘轮:Class 未找到内存缓存

PHP Ratchet: Class Memcache not found

我正在学习 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 抛出一个致命错误

Class Memcache not found in on line 7

此代码放在bin\chat-server.php

奇怪的东西

class 不适用于 chat-server.php 脚本。

服务有两个 不同的 PHP 扩展 memcached:

  • memcache
  • memcached <-- 注意 d

看起来你已经安装了后一个,而你的应用程序需要第一个。

您可以找到 Windows here

的正确扩展名