Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can't get memcached up and running
  • I keep getting the fuel error that my php doesn't have memcached extention loaded. Fuel\Core\Fuel_Exception [ Error ]: Memcached cache are configured, but your PHP installation doesn't have the Memcached extension loaded. But if i echo phpinfo() I can clearly see the extention there. I can see the memcached process running on the server as well. In addition if I put something like
    $memcache = new Memcache;
    $memcache->connect('', 11211);

    on a page I'll get an output of Memcache Object ( [connection] => Resource id #3 ) which leads me to believe its not a php issue. Not sure if its relevant but shouldn't it be trying to load the memcache extension not memcached any thoughts on how to troubleshoot this?
  • As you have discovered, there are two implementations in PHP to acces memcached: the old one (memcache) and the new one (memcached). Fuel implements the new one, with is more feature rich, less buggy, but requires a PECL module to be installed on the server. old:
    new: I have to admit there choice of naming could have been better...
  • Gotcha, I also figured out that centos 5.6, my os, removed the pecl and memcache packages which is why I was having so much trouble.
  • i have same problem with memcached
    memcached and every things it needs are installed on my OS (ubuntu 10.04)
    this command: [/etc/init.d/memcached start] says me [memcached is already running], but fuel says:
    [Memcached cache are configured, but your PHP installation doesn't have the Memcached extension loaded.]
    what is the problem?
  • here a sample code (form for test memcached:
    $memcache = new Memcache;
    $memcache->connect('localhost', 11211) or die ("Could not connect"); $version = $memcache->getVersion();
    echo "Server's version: ".$version."<br/>\n"; $tmp_object = new stdClass;
    $tmp_object->str_attr = 'test';
    $tmp_object->int_attr = 123; $memcache->set('key', $tmp_object, false, 10) or die ("Failed to save data at the server");
    echo "Store data in the cache (data will expire in 10 seconds)<br/>\n"; $get_result = $memcache->get('key');
    echo "Data from the cache:<br/>\n"; var_dump($get_result); and here its result: Server's version: 1.4.2
    Store data in the cache (data will expire in 10 seconds)
    Data from the cache:
    object(stdClass)#13 (2) { ["str_attr"]=> string(4) "test" ["int_attr"]=> int(123) }
  • hueman, what php version is running? I personally use, but notices that after upgrading to 5.3.8 - my memcached stopped working and I get the same error :/
  • my PHP version: 5.3.2
  • I ended up just changing the fuel cache class to use memcache. The methods for Memcached and Memcache are pretty much identical so it was just a few lines to change. Not an ideal solution, but I don't want to install 3rd party php rpm's that might affect other packages.
    // do we have the PHP memcached extension available
                if (!class_exists('Memcache')) {
                    throw new \Fuel_Exception('Memcache cache are configured, but your PHP installation doesn\'t have the Memcache extension loaded.');
                $memcache = new \Memcache;
                $memcache->addServer('', 11211);
                $this->memcached = $memcache;

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion