简体   繁体   English

Drupal —致命错误:找不到类“ Memcache”

[英]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模块]
bz2 bz2
ctype 类型
date 日期
dom dom
filter 过滤
gd d
hash 杂凑
iconv 图标
json json
libxml 的libxml
mbstring mbstring
mcrypt 加密
mysql MySQL的
mysqli mysqli
pcre pcre
PDO PDO
pdo_mysql pdo_mysql
pdo_sqlite pdo_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的解决方案。

  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服务

  2. Install memcached daemon for php and run it as a daemon. 为php安装memcached守护程序并将其作为守护程序运行。

  3. 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文件中有一个可用的类。

  • Did you upgrade your drupal module? 您是否升级了drupal模块?
  • In such cases it's good to look at the issue que for the module on drupal.org. 在这种情况下,最好在drupal.org上查看模块的问题队列。

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。

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. 我的看法是,memecache可能已安装在您的计算机上,但是在使用memecache之前,此问题未通过PHP正确编译。 check here for more details 在这里查看更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Memcache&php:致命错误:未找到类'Memcache' - Memcache & php: Fatal error: Class 'Memcache' not found in 致命错误:未找到类“Memcache” - Fatal error: Class 'Memcache' not found in 致命错误:找不到类“ Memcache” - Fatal error: Class 'Memcache' not found 致命错误:未找到类'Memcache'(与pecl一起安装) - Fatal error: Class 'Memcache' not found (installed with pecl) PHP memcached 致命错误:找不到“Memcache”类 - PHP memcached Fatal error: Class 'Memcache' not found 在Windows Server上安装memcached时出现“致命错误:找不到类'Memcache'” - “Fatal error: Class 'Memcache' not found” when installing memcached on Windows Server 致命错误:在Zend Framework + Wamp中找不到类“ Memcache” - Fatal error: Class 'Memcache' not found in Zend Framework + Wamp “尝试在Ubuntu中安装Memcache时发生致命错误:类'Memcached'未找到” - “Fatal error: Class 'Memcached' not found” when trying to install Memcache in Ubuntu 即使安装了memcache扩展,在wordpress的object-cache.php中也出现了“ PHP致命错误:找不到类'Memcache'” - “PHP Fatal error: Class 'Memcache' not found” occurred in object-cache.php of wordpress even after installed memcache extension 致命错误:找不到类别“ 2” - Fatal error: Class '2' not found in
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM