[英]Drupal — Fatal error: Class 'Memcache' not found
I have installed drupal on my localhost. 我已经在本地主机上安装了drupal。 It worked well 2 months ago, but now something happened and I don't know why.
它在2个月前运作良好,但现在发生了一些事情,我不知道为什么。 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
致命错误:在第177行的/srv/www/htdocs/modules/memcache/dmemcache.inc中找不到类“ Memcache”
1) php -m gives this: 1)php -m给出了以下内容:
[PHP Modules]
[PHP模块]
bz2bz2
ctype类型
date日期
domdom
filter过滤
gdd
hash杂凑
iconv图标
jsonjson
libxml的libxml
mbstringmbstring
mcrypt加密
mysqlMySQL的
mysqlimysqli
pcrepcre
PDOPDO
pdo_mysqlpdo_mysql
pdo_sqlitepdo_sqlite
Reflection session SimpleXML SPL SQLite standard sysvsem tokenizer xml xmlreader xmlwriter zip zlib反射会话SimpleXML SPL SQLite标准sysvsem标记程序xml xmlreader xmlwriter zip zlib
[Zend Modules] none
[Zend模块]无
2) memcached is installed through package manager. 2)memcached是通过软件包管理器安装的。
3) memcache module for drupal installed 3)安装了用于drupal的内存缓存模块
what am I doing wrong? 我究竟做错了什么? thx.
谢谢。
I convene with googletorp that the problem seems to rely on memcache installation. 我与googletorp开会,认为问题似乎取决于内存缓存安装。 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 . 以上过程已从注释中残酷地复制到了正式的memecache文档页面。 It is dated 11.12.09.
日期为11.12.09。
A co-worker helped me today with this issue, I use Drupal & Drush (command line tool), and sometimes MAMP. 今天,一位同事为我解决了这个问题,我使用了Drupal&Drush(命令行工具),有时还使用了MAMP。
Try: 尝试:
echo $PHPRC
If it comes up blank then save this in your ~/.profile or your *~/.bash_profile* config file: 如果出现空白,则将其保存在〜/ .profile或*〜/ .bash_profile *配置文件中:
export PHPRC='/Library/Application Support/appsolute/MAMP PRO/conf/php.ini'
Thank you very much for your answers -- I've eventually managed with this problem. 非常感谢您的回答-我终于解决了这个问题。 Here's the solution as for openSUSE 11.1.
这是针对openSUSE 11.1的解决方案。
Install memcache extension for php : 为php安装memcache扩展 :
#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 现在您应该重新启动apache2服务
Install memcached daemon for php and run it as a daemon. 为php安装memcached守护程序并将其作为守护程序运行。
Install memcache plugin for drupal (all instructions here: http://drupal.org/project/memcache ) 安装Drupal的Memcache插件 (此处提供所有说明: http : //drupal.org/project/memcache )
UPD . UPD 。 be carefull with upgrading PHP: intalled modules might not be working well with new version -- you should recompile them.
升级PHP时要格外小心:安装的模块可能无法在新版本中正常工作-您应该重新编译它们。 but somehow "pear install -f pecl/memcache" did the trick for me :)
但是以某种方式“ pear install -f pecl / memcache”对我有用:)
It seems your memcache drupal module is expecting a class to be available in the inc file mentioned. 看来您的memcache drupal模块期望在提及的inc文件中有一个可用的类。
It looks like it's the drupal module that's the problem. 看起来这是问题的drupal模块。 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. 我看了看模块,当时我在iPhone上,所以无法看清代码。 Your problem is that Drupal can't find the Memcache class.
您的问题是Drupal找不到Memcache类。 This fix is defined in step two of the installation process.
此修复程序在安装过程的第二步中定义。
2. Install the PECL memcache extension for PHP.
2.为PHP安装PECL memcache扩展。 This must be version 2.2.1 or higher or you will experience errors.
该版本必须为2.2.1或更高版本,否则您将遇到错误。
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. 无论如何,Drupal找不到此扩展中定义的
Memcache
,这就是为什么会出现致命错误的原因。
It might be enough to just add extension=memcached.so
to your php.ini
. 仅将
extension=memcached.so
添加到您的php.ini
就足够了。 The location of this file can be found using phpinfo();
可以使用
phpinfo();
找到该文件的位置phpinfo();
Make sure you restart apache afterwards. 确保随后重新启动apache。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.