草庐IT

PHP Ratchet : Class Memcache not found

coder 2024-01-02 原文

我正在学习 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();

当我在命令行中运行脚本时,PHP 抛出一个 fatal error :

Class Memcache not found in on line 7

这段代码放在 bin\chat-server.php 中

奇怪的东西

该类不仅适用于 chat-server.php 脚本。

最佳答案

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

  • 内存缓存
  • memcached <-- 注意="">d

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

您可以找到适用于 Windows 的正确扩展 here

关于PHP Ratchet : Class Memcache not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30817560/

有关PHP Ratchet : Class Memcache not found的更多相关文章

随机推荐