通过 pecl 快速安装 php-memcached 扩展

WBOY
发布: 2016-06-23 13:16:45
原创
1136 人浏览过

通过 pecl 快速安装 php-memcached 扩展

       以前安装 php-memcached 的时一向都是通过源代码编译方式,那个依赖关系、编译速度让你等啊等,好不烦人啊。无意中从网上得知可以使用 pecl 来快速安装这个扩展,在此进行整理并记录之。


系统环境:CentOS-7.1


1、安装 libmemcached

# yum -y install libmemcached-devel Loaded plugins: langpacksResolving Dependencies--> Running transaction check---> Package libmemcached-devel.x86_64 0:1.0.16-3.el7 will be installed--> Processing Dependency: cyrus-sasl-devel(x86-64) for package: libmemcached-devel-1.0.16-3.el7.x86_64--> Running transaction check---> Package cyrus-sasl-devel.x86_64 0:2.1.26-17.el7 will be installed--> Processing Dependency: cyrus-sasl(x86-64) = 2.1.26-17.el7 for package: cyrus-sasl-devel-2.1.26-17.el7.x86_64--> Running transaction check---> Package cyrus-sasl.x86_64 0:2.1.26-17.el7 will be installed…………省略若干行…………Installed:  libmemcached-devel.x86_64 0:1.0.16-3.el7                                                                             Dependency Installed:  cyrus-sasl.x86_64 0:2.1.26-17.el7                       cyrus-sasl-devel.x86_64 0:2.1.26-17.el7                      Complete!
登录后复制
 
登录后复制
登录后复制
<p><strong>2、安装 php-memcached 扩展</strong></p><pre class="scode"># pecl install memcached WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update downloading memcached-2.2.0.tgz ... Starting to download memcached-2.2.0.tgz (70,449 bytes) .................done: 70,449 bytes 15 source files, building running: phpize Configuring for: PHP Api Version: 20100412 Zend Module Api No: 20100525 Zend Extension Api No: 220100525 libmemcached directory [no] : /usr building in /var/tmp/pear-build-rootb7OPED/memcached-2.2.0 running: /var/tmp/memcached/configure --with-libmemcached-dir=/usr …………省略若干行………… Build process completed successfully Installing '/usr/lib64/php/modules/memcached.so' install ok: channel://pecl.php.net/memcached-2.2.0 configuration option "php_ini" is not set to php.ini location You should add "extension=memcached.so" to php.ini 
登录后复制
 
登录后复制
登录后复制

3 、追加模块到 php.ini 文件

# extension=memcached.so
登录后复制
登录后复制
登录后复制
登录后复制
登录后复制

Tips:若直接使用 pecl install memcached 无法安装成功,可以使用以下方法--

# pecl download memcached# tar zxvf memcached-xxx# cd memcached-xxx# phpize# ./configure --with-libmemcached-dir=/xxxx/xxx/xxx
登录后复制
来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板