Welcome Guest, Not a member yet? Register   Sign In
CI 2.0 missing memcache config file
#1

[eluser]joshfng[/eluser]
The user guide says the there should be a config file for memcache located in the application/config/ directory but there is not one there.

Is it located somewhere else?
#2

[eluser]Victor Michnowicz[/eluser]
You gotta create it yourself.
#3

[eluser]joshfng[/eluser]
http://ellislab.com/codeigniter/user-gui...#memcached says its located in the config directory but it is not. If I am supposed to create it myself the docs give no details on what the caching class expects in terms of a config array to pass it.
#4

[eluser]Victor Michnowicz[/eluser]
Yeah, I assumed it was in there as well. I think something like this would go in your memcached.php config file (I have not tested this):

Code:
<?php

$config['memcached'] = array(
    'server_1' => array(
        'host' => '127.0.0.1',
        'port'        => 11211,
        'weight'    => 1
    ),
    'server_2' => array(
        'host' => '127.0.0.2',
        'port'        => 11211,
        'weight'    => 1
    ),
    'server_3' => array(
        'host' => '127.0.0.3',
        'port'        => 11211,
        'weight'    => 1
    )
);

You also gotta remember that memcached is different than memcache. That got me for a while... I created (really just search/replaced) a memcache driver if you are interested. It seems to work well for me.
#5

[eluser]joshfng[/eluser]
Hmm I tried the config file you gave me and it's not working. The weird thing is if I connect to memcached directly using just the memcached ext everything connects and works fine.
#6

[eluser]joshfng[/eluser]
bump
#7

[eluser]Unknown[/eluser]
I'd really like to know what to do with this ...
Any help would be greatly appreciated
#8

[eluser]Unknown[/eluser]
I think the memcached.php config file has to be like this
Code:
<?php
$config['memcached'] = array(
        'hostname' => '127.0.0.1',
        'port'        => 11211,
        'weight'    => 1
);

At least that worked for me.
Also keep in mind what elvicmic mentioned.
Memcached and memcache are different extensions. Check your php.ini which extension is loaded.
#9

[eluser]CoderBoy[/eluser]
Yeah same as m3du54, my memcached.php file

Code:
<?php

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

  $config['memcached'] = array(
          'hostname' => '127.0.0.1',
          'port'        => 11211,
          'weight'    => 1
  );

?>
#10

[eluser]joshfng[/eluser]
Yes this works. Thanks everyone!




Theme © iAndrew 2016 - Forum software by © MyBB