简体   繁体   中英

Memcached is not working on codeigniter

I am trying to use the memcached for my large database queries. So far, I have installed the memcached services and it is running fine. Another thing which I am unable to find is php_memcached.dll file for windows 7, 64 bit. There are few but they talk about php_memcache.dll . I have installed that one and I can see in the Wamp->PHP->PHP extentions that the extension is running. Finally, I have created the memcached.php file in the application/config/ directory and put the following code:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$config = array(
    'default' => array(
        'host'      => 'localhost',
        'port'      => 11211,
        'weight'    => 1
    )
);
?>

Whenever I se phpinfo(); I am unable to locate that memcached is configured. I do not know where I am going wrong. I reckon this is because I have installed memcached service and php_memcache.dll extension. Is this could be the reason ??

Or what could be potentially reason that it is not working on codeigniter.?

codeigniter is trying to load the php memcached extension which is most likely not the one that comes with your windows installation. You will need to modify cached_memcached.php file located in the libraries folder.

and find this line

$this->memcached = new Memcached();

replace it with

 $this->memcached = new Memcache();

you can also choose to install the php memcached extension through pecl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM