PHP Ratchet: Memcache class not found

I follow the Ratchet instructions. On the SessionProvider page, the code is as follows:

<?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 causes a fatal error when running a script in command-line :

Memcache class not found on line 7

This code is placed in bin \ chat-server.php

Wierd stuff

The class is not available only for chat-server.php script.

+8
php ratchet
source share
1 answer

There are two different PHP extensions for memcached service:

  • memcache
  • memcached <- mark d

It looks like you installed the latter while you need the former for your application.

You can find the correct extension for Windows here

+4
source share

All Articles