安装依赖
首先是 memcached,这个扩展需要 libmemcached 客户端库,否则会出现如下错误
checking for libmemcached location... configure: error: memcached support requires libmemcached. Use --with-libmemcached-dir=<DIR> to specify the prefix where libmemcached headers and library are located
ERROR: `/var/tmp/memcached/configure --with-libmemcached-dir=no' failed
可以通过如下方法安装
[root@localhost]# yum install libmemcached libmemcached-devel
而 memcache 模块使用了函数 zlib 来支持数据压缩,因此安装此模块需要安装 Zlib 模块。否则会出现如下错误:
checking for the location of zlib... configure: error: memcache support requires ZLIB. Use --with-zlib-dir=<DIR> to specify prefix where ZLIB include and library are located
ERROR: `/var/tmp/memcache/configure --enable-memcache-session=No' failed
可以如下方法用 yum 来安装:
[root@localhost]# yum install zlib zlib-devel
安装 memcached 扩展
下载:
wget https://pecl.php.net/get/memcached-3.1.5.tgz
解压&安装
tar -zxvf memcached-3.1.5.tgz
cd memcached-3.1.5
/usr/local/php/bin/phpize && ./configure && make && make install
//编译后,修改php.ini 文件
//增加
extension = memcached.so
php -m |grep memcached 查到有的。
至此: 安装完成 。
网友评论