title: symfony2: Attempted to load class "Memcache" from namespace
body: <p>I using memcache with symfony2 and ratchet I installed memcache using this command line </p>
  
  <pre><code>sudo apt-get install php-memcache -y
  </code></pre>
  
  <p>I edited this lines on <code>php.ini</code> file </p>
  
  <pre><code>session.save_handler=memcache
  session.save_path="localhost:11211"
  </code></pre>
  
  <p>but when i use this line </p>
  
  <pre><code>$memcache = new Memcache;
  </code></pre>
  
  <p>I get this error </p>
  
  <pre><code>symfony2: Attempted to load class "Memcache" from namespace 
  </code></pre>
  
  <p>my code socketcommand.php</p>
  
  <pre><code>&lt;?php
  namespace check\roomsBundle\Command;
  use Ratchet\Session\SessionProvider;
  use Symfony\Component\HttpFoundation\Session\Storage\Handler;
  use Ratchet\App;
  use Symfony\Component\Console\Command\Command;
  use Symfony\Component\Console\Input\InputInterface;
  use Symfony\Component\Console\Output\OutputInterface;
  
  // Include ratchet libs
  use Ratchet\Server\IoServer;
  use Ratchet\Http\HttpServer;
  use Ratchet\WebSocket\WsServer;
  use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
  // Change the namespace according to your bundle
  use check\roomsBundle\Sockets\Chat;
  use Doctrine\ORM\EntityManager;
  use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler;
  use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
  
  class SocketCommand extends ContainerAwareCommand
  {
      protected function configure()
      {
          $this-&gt;setName('sockets:start-chat')
              // the short description shown while running "php bin/console list"
              -&gt;setHelp("Starts the chat socket demo")
              // the full command description shown when running the command with
              -&gt;setDescription('Starts the chat socket demo')
          ;
      }
  
      protected function execute(InputInterface $input, OutputInterface $output)
      {
          $output-&gt;writeln([
              'Chat socket',// A line
              '============',// Another line
              'Starting chat, open your browser.',// Empty line
          ]);
          $memcache = new Memcache;
          $memcache-&gt;connect('localhost', 11211);
  
          $session = new SessionProvider(
              new Chat(new MyApp(), $this-&gt;getContainer()),
              new Handler\MemcacheSessionHandler($memcache)
          );
  
          $server = new App('localhost');
          $server-&gt;route('/sessDemo', $session);
          $server-&gt;run();
      }
  
  }
  </code></pre>
  
  <p>my chat.php </p>
  
  <pre><code>&lt;?php
  namespace check\roomsBundle\Sockets;
  use tuto\testBundle\Entity\Users;
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Symfony\Component\HttpFoundation\Request;
  use Ratchet\WebSocket\WsServerInterface;
  use Ratchet\MessageComponentInterface;
  use Ratchet\ConnectionInterface;
  use Symfony\Component\DependencyInjection\ContainerInterface;
  use Doctrine\ORM\EntityManager;
  use Symfony\Component\DependencyInjection\ContainerInterface as Container;
  use Symfony\Component\HttpFoundation\Session\Session;
  
  
  class Chat extends Controller implements MessageComponentInterface, WsServerInterface
  {
      protected $container;
      protected $clients;
  
      //protected $em;
  
      //protected $db;
      public function __construct(ContainerInterface $container) {
          $this-&gt;clients = new \SplObjectStorage;
          $this-&gt;container = $container;
  
  
          //$this-&gt;em = $em;
          //$this-&gt;container = $container;
          //$this-&gt;em = $em;
      }
  
      public function onOpen(ConnectionInterface $conn) {
          $this-&gt;clients-&gt;attach($conn);
  
          if (!isset ($conn-&gt;Session) || !$conn-&gt;Session instanceof Session) {
              throw new \RuntimeException('Session is not defined. Make sure that SessionProvider is executed before FOSUserProvider.');
          }
          try {
              $token      = unserialize($conn-&gt;Session-&gt;get('_security_main'));
              $user       = $token-&gt;getUser();
              $provider   = $this-&gt;_container-&gt;get('fos_user.user_provider.username');
              $conn-&gt;User = $provider-&gt;refreshUser($user);
          } catch (Exception $ex) {
              $conn-&gt;User = null;
          }
      }
  </code></pre>