PHP 致命错误:在其中找不到“Memcached”类

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22941882/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 16:23:03  来源:igfitidea点击:

PHP Fatal error: Class 'Memcached' not found in

phpmemcached

提问by Saurabh Chandra Patel

php -v :

php -v :

PHP 5.5.10-1+deb.sury.org~precise+1 (cli) (built: Mar 27 2014 16:18:01) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with XCache v3.1.0, Copyright (c) 2005-2013, by mOo
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
    with XCache Optimizer v3.1.0, Copyright (c) 2005-2013, by mOo
    with XCache Cacher v3.1.0, Copyright (c) 2005-2013, by mOo
    with XCache Coverager v3.1.0, Copyright (c) 2005-2013, by mOo

dpkg -l | grep php5

dpkg -l | php 5

result

结果

rc  php5-memcache                                   3.0.6-1                                             memcache extension module for PHP5
rc  php5-memcached                                  1.0.2-2                                             memcached extension module for PHP5, uses libmemcached
ii  php5-mysql                                      5.5.10+dfsg-1+deb.sury.org~precise+1                MySQL module for php5

php.ini setting .

php.ini 设置。

;;;;;;;;;;;;;;;;;;;;;;;;;
;;   memchached        ;;
;;;;;;;;;;;;;;;;;;;;;;;;;

extension=/usr/lib/php5/20090626/memcache.so
extension=memcached.so
memcache.hash_strategy="consistent"

but phpinfo not showing memchache details. and php script giving PHP Fatal error: Class 'Memcached' not found in

但 phpinfo 没有显示 memchache 详细信息。和 php 脚本给PHP Fatal error: Class 'Memcached' not found in

采纳答案by Saurabh Chandra Patel

php5-memcacheand php5-memcachedaren't installed. the "rc"in the dpkg output means, that the packages have been uninstalled, and that the configuration has been kept.

php5-memcache并且php5-memcached没有安装。该"rc"dpkg的输出手段,该包已被卸载,并且配置一直保持。

回答by ansuman chauhan

dpkg -l | grep php5 indicate that module is not install

dpkg -l | grep php5 表示未安装模块

iimeans 'It should be installed and it is installed' whereas

ii表示“应该安装并安装它”,而

rcmeans 'It's removed/uninstalled but it's configuration files are still there'

rc意味着“它已被删除/卸载,但它的配置文件仍然存在”

回答by Phill Healey

Use the following to install 'Memcache'

使用以下安装'Memcache'

sudo apt-get install php5-memcache

回答by Praveen

Fatal error: Class 'Memcached' not found

致命错误:找不到“Memcached”类

the library might be missing, you can manually include the missing php_memcache into the ext folder

库可能丢失,您可以手动将丢失的 php_memcache 包含到 ext 文件夹中