Linux Memcached 没有出现在 phpinfo() 中

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5009450/
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-05 02:52:30  来源:igfitidea点击:

Memcached not showing up in phpinfo()

phplinuxmemcachedredhat

提问by mlebrun15

I've installed libmemcached and memcached pecl extension for php and for some reason it's not installing correctly? i've got memcached.so in /usr/lib64/php/ with the right permissions and libmemcache.so in /usr/local/lib/

我已经为 php 安装了 libmemcached 和 memcached pecl 扩展,但由于某种原因它没有正确安装?我在 /usr/lib64/php/ 中获得了具有正确权限的 memcached.so,在 /usr/local/lib/ 中获得了 libmemcache.so

Everything seemed to build correctly without error, and I restarted apache?

一切似乎都没有错误地正确构建,我重新启动了 apache?

i also have the daemon installed.

我也安装了守护进程。

I somehow easily got the Memcache class easily installed for php before, but I realized what i wanted was the Memcached (note the d) class. let me know if more info is needed!

我之前以某种方式轻松地为 php 轻松安装了 Memcache 类,但我意识到我想要的是 Memcached(注意 d)类。如果需要更多信息,请告诉我!

EDIT: I previously had memcache (without the d) working in php so I know i was manipulating the correct php.ini!

编辑:我以前在 php 中使用过 memcache(没有 d),所以我知道我正在操作正确的 php.ini!

EDIT 2: there WAS indeed an apache error!

编辑 2:确实存在 apache 错误!

Unable to load dynamic library '/usr/lib64/php/modules/memcached.so' - /usr/lib64/php/modules/memcached.so: undefined symbol: php_json_encode in Unknown on line 0

采纳答案by steinkel

I've solved it in centos5 using the yum installer instead of the pecl install memcached

我已经在 centos5 中使用 yum 安装程序而不是 pecl install memcached 解决了这个问题

THIS way --> yum install php-pecl-memcached

这样 --> yum install php-pecl-memcached

then, service httpd restart and it shows up in phpinfo()

然后,服务 httpd 重新启动并显示在 phpinfo() 中

回答by Andrey Nikishaev

I have the similar error few days ago. Instaling of new version(2.0) of memcached helped me.

几天前我有类似的错误。安装新版本(2.0)的 memcached 对我有帮助。

yum -y install gcc-c++
wget http://launchpad.net/libmemcached/1.0/0.50/+download/libmemcached-0.50.tar.gz
tar xzf libmemcached-0.50.tar.gz 
cd libmemcached-0.50
./configure 
make 
make install
wget http://pecl.php.net/get/memcached-2.0.0b2.tgz
pecl install memcached-2.0.0b2.tgz
echo 'extension=memcached.so' > /etc/php.d/memcached.ini
service php-fpm restart
cd ..
rm -r libmemcached-0.50*
rm -r memcached-

回答by Ajay Venugopal

add

添加

extension=memcache.so

in php.ini then restart apache

在 php.ini 然后重启 apache

回答by CIRCLE

I don't know if it's the same problem but after struggling with this for hours I manage to have PHP properly installed with Memcached on CentOS using the command bellow:

我不知道这是否是同样的问题,但在为此挣扎了几个小时后,我设法使用以下命令在 CentOS 上正确安装了带有 Memcached 的 PHP:

yum --enablerepo=remi-php73 install php-memcached

Test installation:

测试安装:

php -i | grep -i memcache

Should show something like:

应该显示如下内容:

/etc/php.d/50-memcached.ini
memcached
memcached support => enabled
libmemcached version => 1.0.18
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.default_binary_protocol => Off => Off
memcached.default_connect_timeout => 0 => 0
memcached.default_consistent_hash => Off => Off
memcached.serializer => igbinary => igbinary
memcached.sess_binary_protocol => On => On
memcached.sess_connect_timeout => 0 => 0
memcached.sess_consistent_hash => On => On
memcached.sess_consistent_hash_type => ketama => ketama
memcached.sess_lock_expire => 0 => 0
memcached.sess_lock_max_wait => not set => not set
memcached.sess_lock_retries => 5 => 5
memcached.sess_lock_wait => not set => not set
memcached.sess_lock_wait_max => 150 => 150
memcached.sess_lock_wait_min => 150 => 150
memcached.sess_locking => On => On
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_persistent => Off => Off
memcached.sess_prefix => memc.sess.key. => memc.sess.key.
memcached.sess_randomize_replica_read => Off => Off
memcached.sess_remove_failed_servers => Off => Off
memcached.sess_sasl_password => no value => no value
memcached.sess_sasl_username => no value => no value
memcached.sess_server_failure_limit => 0 => 0
memcached.store_retry_count => 2 => 2
Registered save handlers => files user memcached