現象
ページアクセス時に以下のWARNINGが出る
using touch command with binary protocol is not recommended with libmemcached versions below 1.0.18, please use ascii protocol or upgrade libmemcached
環境
CentOS Linux release 7.4.1708
nginx/1.10.2
PHP 7.1.10 (fpm-fcgi)
php-fpm
やりたいこと
php -i | grep memcache
でlibmemcachedのバージョンを確認したら1.0.16
だったのでバージョンを1.0.18
にあげたい
ポイント
今までの環境では以下のようにphp-pecl-memcachedをyumでインストールしていたけどこれだと1.0.16
になってしまう様子
yum -y install memcached
yum -y install --enablerepo=remi,remi-php71 php php-devel php-mbstring php-pdo php-gd php-mcrypt php-fpm php-mysqlnd php-opcache php-apcu php-xml php-tokenizer php-openssl php-pecl-memcached
対応
php-pecl-memcachedを辞めて
# memcached
yum -y install memcached
wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar xvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure
make
make install
cd ../
wget http://pecl.php.net/get/memcached-3.0.3.tgz
tar xvf memcached-3.0.3.tgz
yum -y install autoconf
yum -y install zlib-devel
cd memcached-3.0.3
phpize
./configure --with-libmemcached-dir=/usr/local/ --disable-memcached-sasl
make
make install
cd ../
systemctl enable memcached
/etc/php.ini に以下を追加
extension=memcached.so
結果
# php -i | grep memcache
memcached
memcached support => enabled
libmemcached version => 1.0.18
memcached.compression_factor => 1.3 => 1.3
memcached.compression_threshold => 2000 => 2000
memcached.compression_type => fastlz => fastlz
memcached.default_binary_protocol => 0 => 0
memcached.default_connect_timeout => 0 => 0
memcached.default_consistent_hash => 0 => 0
memcached.serializer => php => php
memcached.sess_binary_protocol => 1 => 1
memcached.sess_connect_timeout => 0 => 0
memcached.sess_consistent_hash => 1 => 1
memcached.sess_lock_expire => 0 => 0
memcached.sess_lock_max_wait => not set => not set
memcached.sess_lock_retries => 5 => 5
memcached.sess_lock_wait => not set => not set
memcached.sess_lock_wait_max => 2000 => 2000
memcached.sess_lock_wait_min => 1000 => 1000
memcached.sess_locking => 1 => 1
memcached.sess_number_of_replicas => 0 => 0
memcached.sess_persistent => 0 => 0
memcached.sess_prefix => memc.sess. => memc.sess.
memcached.sess_randomize_replica_read => 0 => 0
memcached.sess_remove_failed_servers => 0 => 0
memcached.sess_sasl_password => no value => no value
memcached.sess_sasl_username => no value => no value
memcached.sess_server_failure_limit => 0 => 0
memcached.store_retry_count => 2 => 2
Registered save handlers => files user memcached
session.save_handler => memcached => memcached
WARNINGが出なくなりました!