Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Ratchet: Class Memcache not found

Tags:

php

ratchet

I am following Ratchet's tutorials. For SessionProvider page, the code is like this:

<?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:

Class Memcache not found in 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.

like image 235
Muhammad Talha Akbar Avatar asked Jun 13 '15 10:06

Muhammad Talha Akbar


1 Answers

There are two distinct PHP extensions for the service memcached:

  • memcache
  • memcached <-- note the 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

like image 118
hek2mgl Avatar answered Sep 21 '22 05:09

hek2mgl