【问题标题】:Memcached not showing up in phpinfo()Memcached 未显示在 phpinfo() 中
【发布时间】:2011-06-27 22:10:03
【问题描述】:

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

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

我也安装了守护进程。

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

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

编辑 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

【问题讨论】:

  • 你能确认你的 apache 错误日志中没有错误吗?
  • 您是否将extension=memcache.so 添加到正确的php.ini 中?
  • 是的,有一个错误。如何修复错误显示?
  • 只需修复扩展加载顺序,json 在 memcached 之前。 (使用分发包,每个扩展都有其配置文件以确保正确加载顺序的数字开头)

标签: php linux memcached redhat


【解决方案1】:

我不知道这是否是同样的问题,但经过几个小时的努力,我设法使用下面的命令在 CentOS 上正确安装了 PHP 和 Memcached:

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

测试安装:

php -i | grep -i memcache

应该显示类似:

/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

【讨论】:

    【解决方案2】:

    添加

    extension=memcache.so
    

    在 php.ini 中然后重启 apache

    【讨论】:

      【解决方案3】:

      几天前我遇到了类似的错误。安装新版本(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-
      

      【讨论】:

        【解决方案4】:

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

        这种方式 --> yum install php-pecl-memcached

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

        【讨论】:

        • 嗯,没想到这个。下次我试试这个!
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-02-10
        • 1970-01-01
        • 2019-02-15
        • 2012-07-28
        • 1970-01-01
        • 1970-01-01
        • 2010-11-29
        相关资源
        最近更新 更多