memcached make: *** No targets specified and no makefile found. Stop.

其实是因为在安装libevent时增加了版本号导致的,所以注意在安装libevent时不要增加版本号

1.rpm -qa|grep libevent
查看系统是否带有该安装软件,如果有执行命令:

rpm -e libevent-1.4.13-4.el6.i686 --nodeps(由于系统自带的版本旧,忽略依赖删除)

2. 安装libevent命令: (https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz)
tar zxvf libevent-2.0.21-stable.tar.gz
 cd libevent-2.0.21-stable
 ./configure --prefix=/usr
make
make install
至此libevent安装完毕

在 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 typemake: *** [php_memcached.lo] Error 1……

php的扩展memcache,不支持cas,所以我们要装memcached扩展,memcached扩展是基于libmemcached,所以要先安装libmemcached

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz
tar zxvf libmemcached-1.0.18.tar.gz
cd libmemcached-1.0.18
./configure --prefix=/usr/local/libmemcached --with-memcached
make
make install

checking for libevent directory... configure: error: libevent is required. You can get it from http://www.monkey.org/~provos/libevent/

If it's already installed, specify its path using --with-libevent=/dir/

提示需要libevent,需要指明libevent的安装目录

memcached 依赖于 libevent 库,因此我们需要先安装 libevent.,ibevent和memcached的下载路径

http://sourceforge.net/projects/levent/?source=typ_redirect

[root@localhost upload]#tar zxvf libevent-2.0.21-stable.tar.gz

[root@localhost upload]# cd libevent-2.0.22-stable

[root@localhost upload]#./configure --prefix=/usr/local/libevent

[root@localhost upload]#make && make install

[root@localhost upload]#   ./configure --prefix=/usr/local/memcached --with-libevent=/usr/local/libevent

make: *** [memcache.lo] Error 1:

vi memcache.c

将所有的:zend_list_insert(pool, le_memcache_pool);

改为:zend_list_insert(pool, le_memcache_pool TSRMLS_CC);

将所有的:zend_list_insert(mmc, le_pmemcache);

改为:zend_list_insert(mmc, le_pmemcache TSRMLS_CC);

将所有的:if (!zend_is_callable(failure_callback, 0, NULL))

改为:if (!zend_is_callable(failure_callback, 0, NULL, NULL))