您好,欢迎访问一九零五行业门户网

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

通过 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!


2、安装 php-memcached 扩展
# 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
其它类似信息

推荐信息