The error in the title is repeated every time I go to a page. I'm running drupal 7 and followed the readme instructions. I am running memcached daemon on the specified ip and ports. I am using PECL memcache extension v2.2.6

extension=memcache.so
extension=memcached.so
memcache.hash_strategy="consistent"

are enabled in my php.ini

in my settings.php I have only added these lines of code:

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

Comments

infines’s picture

Also noticed that I'm getting this error when I try install the module (I'm not installing memcache admin module):

Notice: Undefined index: description in drupal_check_module() (line 1146 of /home/folioh/public_html/includes/install.inc).
(Currently using Extensions not available Either the memcache or memcached extensions must be installed in order to use memcache integration.)

catch’s picture

Status: Active » Postponed (maintainer needs more info)

Please check the output of class_exists('Memcache'); and class_exists('Memcached') on your system.

Also add this debug just before this line in dmemcache.inc


      else {
         var_dump($extension); exit;
        drupal_set_message(t('You must enable the PECL memcached or memcache extension to use memcache.inc.'), 'error');
rdickert’s picture

Restarting php-fpm solved it for me (Pressflow 7 on Ubuntu with Nginx with php-fpm). I'm not sure if this would apply to the standard php package. Try this if you just installed everything and got this error.

Command on Ubuntu:
/etc/init.d/php5-fpm restart #php-fpm only

yannisc’s picture

Version: 7.x-1.0-rc2 » 7.x-1.0

I have the same problem at 7.x-1.0 version.

class_exists('Memcached') reports "1".

yannisc’s picture

It was my mistake! I was looking the wrong php.ini file!

Vic_’s picture

I am also getting this error,

You must enable the PECL memcached or memcache extension to use memcache.inc.
You must enable the PECL memcached or memcache extension to use memcache.inc.
Notice: Undefined variable: result in dmemcache_get() (line 107 of /sites/all/modules/contrib/memcache/dmemcache.inc).

Im posting the link so you guys know where im coming from with this, im running a drupal 7 site.

the only difference is that im memcache on MAMP and not as daemon.

I am however getting the same error, I will be posting the solution here if I find it ;)

umeshpatil’s picture

To get rid of this error I added "extension=memcache.so" in my "/etc/php5/apache2/php.ini" file , after that restart apache server by "/etc/init.d/apache2 restart".
Courtesy -
http://www.stevekarsch.com/node/2920

Saytan’s picture

Hello there,

I would also be interested if you found the answer when you run MAMP as a server.
I have exactly the same error message, and adding extension=memcache.so in the php.ini doesn't help.

Thank you, bye.

dajjen’s picture

Check that you have the right settins in your settings.php file.
ex.

$conf['cache_backends'][] = '[path/to/contrib/module]/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_servers'] = array('127.0.0.1:11211' => 'default');
$conf['memcache_bins'] = array('cache' => 'default');

reload apache.
sudo service apache reload

erikwebb’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

This looks like a common problem with setup, especially on MAMP. Since this module only performs a class_exists(), there isn't much room for a bug to exist here.

infines’s picture

Status: Closed (works as designed) » Active

I am still getting these errors and I haven't even installed the memcache module!

Here is my setup:

CentOS 5.9
Drupal 7.19
Memcache 7.1.0

settings.php:

$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['memcache_servers'] = array('127.0.0.1:11211' => 'default');
$conf['memcache_bins'] = array('cache' => 'default');
$conf['cache_class_form'] = 'DrupalDatabaseCache';

php.ini (located at /php.ini):

extension=uploadprogress.so
extension=memcached.so

That is the entire contents of my php.ini file. What am I doing wrong?

infines’s picture

Priority: Normal » Critical
erikwebb’s picture

Can you attach your phpinfo information?

infines’s picture

Category: support » bug
Priority: Major » Critical
Status: Closed (fixed) » Active

Here is a link to all the information:

*I have removed this link because I have removed the phpinfo.php file from my website! Please see comment #18 for a solution: http://drupal.org/node/1350978#comment-7117224

erikwebb’s picture

Category: bug » support
Priority: Critical » Major

According to the phpinfo, you don't have either extension installed correctly.

If you do have extension=memcached.so in your php.ini file, maybe that file itself is missing?

infines’s picture

Weird my WHM Panel says I do...so...i know this must be a server issue and not really a memcached issue, but might you know why?

erikwebb’s picture

Status: Active » Closed (cannot reproduce)

I'm not very familiar with WHM Panel, so I'm not sure I can take a guess.

infines’s picture

I fixed this. Just a note to anyone trying to figure it out. You need to edit the proper PHP file.

add a phpinfo.php file to your www or public_html directory containing this code:

<?php phpinfo(); ?>

Then locate where the php.ini file is located and edit that file in that location to include extension=memcached.so

Then restart your server just in case!

This can also be done through whm, but I'm not going to include instructions on that.

infines’s picture

Status: Closed (cannot reproduce) » Closed (fixed)
docans’s picture

Category: bug » support
Priority: Critical » Major

I am running WAMP with PHP 5.2. on windows. How do i install the PECL and memcache

infines’s picture

Status: Active » Closed (fixed)

@docans This is not the place for your question. I suggest you try Google.

erikwebb’s picture

I actually agree that we should have some link to Windows documentation in the README, but I do agree that's a separate issue from this.

infines’s picture

WAMP is on windows but it's just apache....so read the apache documentation on installing memcache/d.

infines’s picture

Issue summary: View changes

memcache.hash_strategy="consistent"

was added

badzilla’s picture

Another consideration here is you will get the error message using drush if you don't have the extension=memcache.so directive in your cli version of your php.ini file even if your Apache configuration is correct. This is because of course drush uses the command line version of PHP.

randell’s picture

Follow-up for #24: you may execute php --ini to determine the location of the cli version of your php.ini. It should show something like this on Windows 7:

Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         C:\Program Files\Drush\Php\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

For posterity's sake, modifying C:\Program Files\Drush\Php\php.ini to add extension=php_memcache.dll then copying php_memcache.dll into the ext directory of PHP in Drush didn't work for me. I had to add my XAMPP's PHP to the PATH environment variable so that it would look like C:\xampp\php;C:\ProgramData\Drush\ to make the error message go away in Drush.

panditvarun20’s picture

Issue summary: View changes

Just follow the link below. You will be able to successfully installed.

in place of nano use gedit to open a file.

Hope this will help you.

http://andrewdunkle.com/how-install-memcached-drupal-7

sstedman’s picture

For me on Mac OS X Mavericks, my local site running fine through nginx/php-fpm, drush was registering errors with the CLI version of php:

WD memcache: You must enable the PHP memcache (recommended) or memcached extension to use memcache.inc. [error]
WD memcache: Failed to connect to memcache server: 127.0.0.1:11211 [error]

Locally I was running php 5.4.

I needed to brew install php54-memcache

then php -r "echo php_ini_loaded_file();" to find my loaded CLI php.ini file.

then vim /etc/php.ini

enter extension=/usr/local/Cellar/php54-memcache/2.2.7/memcache.so and save.

No more errors.

motarski’s picture

sstedman, you are a life saver 10x :)

umeshsapariya’s picture

For me it solved the issue by following below steps,

1. check if memcache PHP extension is enabled by running get_loaded_extensions()

2. if not just install PHP extension using sudo apt-get install php5.6-memcache

itdevshri’s picture

#27 save the day for me.

Thanks @sstedman