自升级了php7.1.9以来,开发环境就一直报错,因为使用了memcache扩展。windows下环境,官方提供的是5.6以下版本 3.0.8,对于最新版还未提供。但是在官方github上有php7的分支代码,动手能力强的可以自行下载源及对应php版本、工具进行编译。传送门:https://github.com/websupport-sk/pecl-memcache
我使用的方法是github上开源编译好的dll库,只需按对应版本配置就可以正常使用了。链接:https://github.com/nono303/PHP7-memcache-dll
phpinfo()查看对应vc版本,找到你想要的dll文件,下载放置php安装目录下的ext目录,并配置php.ini。作者说明了可能存在2个bug,需要的配置如下:
[Memcache]
; https://php.net/manual/fr/memcache.ini.php
extension=”ext\php_memcache.dll”
memcache.allow_failover = 0
; memcache.max_failover_attempts = 20
memcache.chunk_size = 32768
memcache.default_port = 11211
; https://blog.rodolphe.quiedeville.org/index.php?post/2012/10/php-session-redondantes-memcache-failover
; memcache.hash_strategy = consistent
memcache.hash_strategy = standard
memcache.hash_function = crc32
memcache.protocol = ascii
; Bug with session_destroy() in binary
; memcache.protocol = binary
; memcache.redundancy = 1
; memcache.session_redundancy = 2
memcache.compress_threshold = 20000
; https://bugs.php.net/bug.php?id=58802
memcache.lock_timeout = 1
转载请注明:TUTERM.COM » php7.x配置memcache方法