安装PHP7.0.9 报错Deprecated: PHP Startup: memcached.sess_lock_wait …..的解决办法

本文介绍了解决PHP7.0.6中memcached扩展报错的方法,主要是通过更新配置文件中的变量名称来避免启动时出现的废弃警告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装最新的php7.0.6在安装成功后运行 php -m 查看安装了哪些扩展 ,或者执行任意php命令报错

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.6 (cli) (built: Apr 29 2016 04:21:39) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
~ php -m
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

 

遇到以上报错提示.在研究了一番后发现,原来是最新的PHP7.0.9的memcached 扩展弃用了 两个变量命名
以前老版本的

memcached.sess_lock_wait
memcached.sess_lock_max_wait

被这个两个名字给取代了

memcached.sess_lock_wait_min
memcached.sess_lock_wait_max

(注意“max”现在的变量名)。 改变这些变量名和设置为0(默认)或其他值。这些默认值在配置的上方有说明。

所以说我们只需要将上面的那两个改为下面的这两个就可以了

首先找到 /usr/local/etc/php/7.0/conf.d 这个目录 下的ext-memcached.ini
在15行改为 memcached.sess_lock_wait_min = 150000
然后在21行改为memcached.sess_lock_wait_max = 0;

然后保存退出,再运行 php -v 就不会报此错误了.

转载于:https://www.cnblogs.com/dasn/articles/5734122.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值