個人系統環境是:centos6.5php
安裝php memcached遇到的坑。html
參考博主【陽光溫暖了心情】文章地址:http://www.cnblogs.com/yangxia-test/p/4195288.htmlredis
文件:libmemcached-1.0.18.tar.gz
一、libmemcached下載地址:https://launchpad.net/libmemcached/+downloadapache
文件:memcached-2.2.0.tgzcentos
二、php-memcached下載地址:http://pecl.php.net/package/memcachedmemcached
在 php-memcached官網發現有最新的版本3.0.3 stable版本,安裝幾回沒有成功,總提示:
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4361: error: too few arguments to function ‘zend_declare_class_constant_bool’
/bby_install/install-pack/memcached-3.0.1/php_memcached.c: In function ‘zm_startup_memcached’:
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4371: error: ‘zend_object_handlers’ has no member named ‘offset’
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4373: error: ‘zend_object_handlers’ has no member named ‘free_obj’
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4378: error: too few arguments to function ‘zend_register_internal_class’
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4378: warning: assignment from incompatible pointer type
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4379: warning: assignment from incompatible pointer type
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: error: too few arguments to function ‘zend_register_internal_class_ex’
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: warning: assignment from incompatible pointer type
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4379: warning: assignment from incompatible pointer type
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: error: too few arguments to function ‘zend_register_internal_class_ex’
/bby_install/install-pack/memcached-3.0.1/php_memcached.c:4393: warning: assignment from incompatible pointer type
make: *** [php_memcached.lo] Error 1……spa
以後下載3.0.1編譯仍是同樣不能經過,只好根據博主文章中提到的,下載了php-memcached 2.2.0,按照博主介紹的方法安裝,一步到位安裝成功。.net
參考博主【陽光溫暖了心情】文章地址:http://www.cnblogs.com/yangxia-test/p/4195288.htmldebug
php的擴展memcache,不支持cas,因此咱們要裝memcached擴展,memcached擴展是基於libmemcached,因此要先安裝libmemcachedrest
1、下載軟件
一、libmemcached下載地址:https://launchpad.net/libmemcached/+download
文件:memcached-2.2.0.tgz
二、php-memcached下載地址:http://pecl.php.net/package/memcached
文件:libmemcached-1.0.18.tar.gz
2、安裝libmemcached
[root@vm15 local]# mkdir -p libmemcached
[root@vm15 local]# tar zxvf libmemcached-1.0.18.tar.gz
[root@vm15 local]# cd libmemcached-1.0.18
[root@vm15 libmemcached-1.0.18]# ./configure --prefix=/usr/local/libmemcached --with-memcached
[root@vm15 libmemcached-1.0.18]# make
[root@vm15 libmemcached-1.0.18]# make install
3、安裝php-memcached
[root@vm15 local]# mkdir -p phpmemcached
[root@vm15 local]# tar zxvf memcached-2.2.0.tgz
[root@vm15 local]# cd memcached-2.2.0
[root@vm15 memcached-2.2.0]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@vm15 memcached-2.2.0]# ./configure --enable-memcached --with-php-config=/usr/local/php/bin/php-config --with-libmemcached-dir=/usr/local/libmemcached --disable-memcached
-sasl
[root@vm15 memcached-2.2.0]# make
[root@vm15 memcached-2.2.0]# make install
Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
[root@vm15 memcached-2.2.0]# ll /usr/local/php/lib/php/extensions/no-debug-zts-20131226/
total 2140
-rwxr-xr-x. 1 root root 325608 Dec 30 15:59 memcached.so
-rwxr-xr-x. 1 root root 453766 Dec 30 17:44 memcache.so
-rwxr-xr-x. 1 root root 540834 Dec 19 15:38 opcache.so
-rwxr-xr-x. 1 root root 861055 Dec 30 16:47 redis.so
[root@vm15 memcached-2.2.0]# vi + /usr/local/php/lib/php.ini
加上extension=memcached.so
#重啓Apache服務[root@vm15 memcached-2.2.0]# /usr/local/apache2/bin/apachectl restart查看phpinfo能夠看到支持了