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
The class is not available only for chat-server.php
script.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With