views:

1557

answers:

5

Hello, I have installed drupal on my localhost. It worked well 2 months ago, but now something happened and I don't know why. I'll be very grateful if you can help me. Thanks in advance.

The full error looks like this:

Fatal error: Class 'Memcache' not found in /srv/www/htdocs/modules/memcache/dmemcache.inc on line 177

1) php -m gives this:

[PHP Modules]
bz2
ctype
date
dom
filter
gd
hash
iconv
json
libxml
mbstring
mcrypt
mysql
mysqli
pcre
PDO
pdo_mysql
pdo_sqlite
Reflection session SimpleXML SPL SQLite standard sysvsem tokenizer xml xmlreader xmlwriter zip zlib

[Zend Modules] none

2) memcached is installed through package manager.

3) memcache module for drupal installed

what am I doing wrong? thx.

A: 

It seems your memcache drupal module is expecting a class to be available in the inc file mentioned.

  • Did you upgrade your drupal module?
  • In such cases it's good to look at the issue que for the module on drupal.org.

It looks like it's the drupal module that's the problem. My guess an upgrade went wrong.

EDIT:
I Took at look at the module, I was on my iphone, so couldn't look through the code. Your problem is that Drupal can't find the Memcache class. This fix is defined in step two of the installation process.

2. Install the PECL memcache extension for PHP. This must be version 2.2.1 or higher or you will experience errors.

Either you are missing this now, or something is wrong with the installation. In any regard, Drupal can't find the Memcache that is defined in this extension, and that is why you get the fatal error.

googletorp
thx, i'll try to update it now, but shouldn't be the problem, because it all worked fine. i'm sure the issue is in configuration of php, memcached and other such stuff :)
soshial
+2  A: 

I convene with googletorp that the problem seems to rely on memcache installation. Try this:

#if apt-get, rpm, or yum doesn't work
cd /usr/src/
wget http://pecl.php.net/get/memcache-2.2.4.tgz
tar -zxvf memcached-2.2.4.tgz
cd memcached-2.2.4
phpize && ./configure --enable-memcache && make
cp modules/memcache.so /usr/lib/php/modules/

# Note: packaged extension modules are now loaded via the .ini files
# found in the directory /etc/php.d
touch /etc/php.d/memcached.ini
echo 'extension=memcache.so' > /etc/php.d/memcached.ini

service httpd restart

The above procedure has been brutally copied from the comments to the page of the official memecache documentation. It is dated 11.12.09.

mac
Should there be any amendments to the code provided that I work on openSUSE 11.1?Thx.
soshial
I do not know as I do not run openSUSE on any of my servers. However the only thing that seems like important to be checked is that your php is effectively installed in `/usr/lib/php`. All the rest looks boilerplate to me.
mac
A: 

It might be enough to just add extension=memcached.so to your php.ini. The location of this file can be found using phpinfo();

Make sure you restart apache afterwards.

Evert
A: 

my take is that memecache may be installed on your machine, but it's not correctly compiled with PHP had this issue before with memecache. check here for more details

Yaniv
A: 

Thank you very much for your answers -- I've eventually managed with this problem. Here's the solution as for openSUSE 11.1.

1) Install memcache extension for php:

#if apt-get, rpm, or yum doesn't work
cd /usr/src/
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar -zxvf memcache-2.2.5.tgz
cd memcache-2.2.5
phpize5
./configure --enable-memcache
make
make install
cp modules/memcache.so /usr/lib/php5/extensions/

# Note: packaged extension modules are now loaded via the .ini files
# found in the directory /etc/php5/conf.d/
touch /etc/php5/conf.d/memcache.ini
echo 'extension=memcache.so' > /etc/php5/conf.d/memcache.ini

now you should restart apache2 service

2) Install memcached daemon for php and run it as a daemon.

3) Install memcache plugin for drupal (all instructions here: http://drupal.org/project/memcache)

UPD. be carefull with upgrading PHP: intalled modules might not be working well with new version -- you should recompile them. but somehow "pear install -f pecl/memcache" did the trick for me :)

soshial