【问题标题】:PHP7 / MemCache Deprecated Error MessagePHP7 / MemCache 已弃用错误消息
【发布时间】:2016-02-01 12:23:23
【问题描述】:

我刚刚通过 Homebrew 更新到 PHP7。我现在在执行php -v 时收到以下错误消息:

PHP Deprecated:  PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0
Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0
PHP Deprecated:  PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0
Deprecated: PHP Startup: memcached.sess_lock_wait and memcached.sess_lock_max_wait are deprecated. Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0
PHP 7.0.2 (cli) (built: Jan  7 2016 10:40:26) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
    with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans

谁能建议我哪里出错了?

我通过 Homebrew 列出并安装了以下软件包。

memcached php56-memcached php70-memcached

谢谢。

【问题讨论】:

  • 我想你应该卸载旧的 memcached 包。也许this 可以帮助做到这一点。

标签: php memcached homebrew php-7


【解决方案1】:

我不得不注释掉 /usr/local/etc/php/7.0/conf.d/ext-memcached.ini 中的以下条目。

;memcached.sess_lock_wait = 150000
;memcached.sess_lock_max_wait = 0;

数字以微秒为单位(请参阅http://php.net/manual/en/memcached.configuration.php

PHP 7.0+ 中的新设置是:

; The minimum time, in milliseconds, to wait between session lock attempts.
; This value is double on each lock retry until memcached.sess_lock_wait_max
; is reached, after which any further retries will take sess_lock_wait_max seconds.
; Default is 1000.

memcached.sess_lock_wait_min = 1000;

; The maximum time, in milliseconds, to wait between session lock attempts.
; Default is 2000.

memcached.sess_lock_wait_max = 2000;

; The number of times to retry locking the session lock, not including
; the first attempt.
; Default is 5.

memcached.sess_lock_retries = 5;

来源:https://github.com/php-memcached-dev/php-memcached/blob/master/memcached.ini

【讨论】:

  • 不要忘记替换它们,而不仅仅是删除它们。警告说:Please update your configuration to use memcached.sess_lock_wait_min, memcached.sess_lock_wait_max and memcached.sess_lock_retries in Unknown on line 0
【解决方案2】:

memcached.sess_lock_waitmemcached.sess_lock_max_wait 值已替换为 memcached.sess_lock_wait_minmemcached.sess_lock_wait_max(注意“max”现在位于变量名称的末尾)。更改这些变量名称并根据需要设置为 0(默认)或其他值。如果使用默认值,只需注释掉声明即可。

【讨论】:

    【解决方案3】:

    这里也是同样的问题。但据我所知,目前还没有稳定的版本。见:https://github.com/php-memcached-dev/php-memcached/issues/213#issuecomment-178613213

    【讨论】:

      猜你喜欢
      • 2018-03-18
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 2017-09-20
      • 1970-01-01
      • 2022-01-26
      • 2023-02-16
      相关资源
      最近更新 更多