Linux下给php7安装memcached扩展的步骤
搞这个扩展用了不少时间,之前都是非常快的安装上了。网上搜索了不少文章,多数都是东抄西抄,没法解决问题。
综合了几个文章,终于搞定,这里记录下步骤:
安装memcached
yum -y install memcached
安装完以后执行如下操作:
chkconfig memcached on /etc/init.d/memcached start
执行
netstat -tunlp | grep memcached
看到11211端口,说明memcached安装成功。
安装libmemached
wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz tar -zxvf libmemcached-1.0.16.tar.gz cd libmemcached-1.0.16 ./configure -prefix=/usr/local/libmemcached -with-memcached make && make install
下载memcache扩展包并安装
git clone git://github.com/php-memcached-dev/php-memcached.git cd php-memcached/
安装扩展
/usr/local/php/bin/phpize ./configure -enable-memcached -with-php-config=/usr/local/php/bin/php-config -with-zlib-dir -with-libmemcached-dir=/usr/local/libmemcached -prefix=/usr/local/phpmemcached --disable-memcached-sasl make -j4 make install
安装完毕后会提示扩展目录:/usr/local/php/lib/php/extensions/no-debug-zts-20151012/
编辑php.ini
extension=/usr/local/php/lib/php/extensions/no-debug-zts-20151012/memcached.so
将其放入最后一行,重启php服务器(通过组件调用的,重启下web服务)
重新查看phpinfo