Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP7 / MemCache Deprecated Error Message

I have just updated to PHP7 via Homebrew. I now get the following error message when doing a 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

Can anyone suggest where I'm going wrong?

I have the following packages listed and installed via Homebrew.

memcached php56-memcached php70-memcached

Thanks.

like image 453
hawx Avatar asked Feb 01 '16 12:02

hawx


3 Answers

I had to comment out the following entries in /usr/local/etc/php/7.0/conf.d/ext-memcached.ini.

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

The numbers are in microseconds (see http://php.net/manual/en/memcached.configuration.php)

The new settings in PHP 7.0+ are:

; 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;

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

like image 193
hawx Avatar answered Oct 02 '22 03:10

hawx


The memcached.sess_lock_wait and memcached.sess_lock_max_wait values have been replaced by memcached.sess_lock_wait_min and memcached.sess_lock_wait_max (note "max" is now at the end of the variable name). Change these variable names and set to 0 (for default) or other values as desired. If using defaults, simply commenting out the declarations does the trick.

like image 29
Steve Avatar answered Oct 02 '22 03:10

Steve


Same issue here. But as far as I know there is no stable release yet. See: https://github.com/php-memcached-dev/php-memcached/issues/213#issuecomment-178613213

like image 32
Jonathan Martins Avatar answered Oct 02 '22 04:10

Jonathan Martins