PHP7 / MemCache已弃用的错误消息

时间:2016-02-01 12:23:24

标签: php memcached homebrew php-7

我刚刚通过Homebrew更新到PHP7。我现在在执行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 时收到以下错误消息:

memcached php56-memcached php70-memcached

有谁可以建议我哪里出错了?

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

{{1}}

感谢。

3 个答案:

答案 0 :(得分:14)

我必须在/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

答案 1 :(得分:3)

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

答案 2 :(得分:2)

这里的问题相同。但据我所知,还没有稳定的发布。请参阅:https://github.com/php-memcached-dev/php-memcached/issues/213#issuecomment-178613213