PHP7 安装 memcache

PHP版本:PHP 7.3.16


LINUX版本:7.6

安装成功的样子:

php -r "phpinfo();" | grep memcachememcachememcache support => enabledmemcache.allow_failover => 1 => 1memcache.chunk_size => 32768 => 32768memcache.compress_threshold => 20000 => 20000memcache.default_port => 11211 => 11211memcache.hash_function => crc32 => crc32memcache.hash_strategy => consistent => consistentmemcache.lock_timeout => 15 => 15memcache.max_failover_attempts => 20 => 20memcache.prefix_host_key => 0 => 0memcache.prefix_host_key_remove_subdomain => 0 => 0memcache.prefix_host_key_remove_www => 1 => 1memcache.prefix_static_key => no value => no valuememcache.protocol => ascii => asciimemcache.redundancy => 1 => 1memcache.session_prefix_host_key => 0 => 0memcache.session_prefix_host_key_remove_subdomain => 0 => 0memcache.session_prefix_host_key_remove_www => 1 => 1memcache.session_prefix_static_key => no value => no valuememcache.session_redundancy => 2 => 2memcache.session_save_path => no value => no value

安装步骤:

# 下载 memcache 源码包wget https://github.com/websupport-sk/pecl-memcache/archive/NON_BLOCKING_IO_php7.zip# 解压缩unzip NON_BLOCKING_IO_php7.zip# 进入解压后的目录cd pecl-memcache-NON_BLOCKING_IO_php7/# 生成配置文件/usr/local/php/bin/phpize# 配置./configure --with-php-config=/usr/local/php/bin/php-configmakemake install# 在 php.ini 中添加扩展extension=memcache# 重启服务# 可以使用下面三种方式中的一种(具体看php的安装方式)service php-fpm restartkill -USR2 `cat /usr/local/php/var/run/php-fpm.pid`systemctl reload php-fpm

相关文章