为php安装memcached扩展笔记

1、下载libmemcached库 地址在https://code.launchpad.net/libmemcached

wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz

2、下载php memcached扩展,地址在http://pecl.php.net/package/memcached

wget http://pecl.php.net/get/memcached-2.2.0.tgz

3、解压

[root@localhost solf]# tar xzf libmemcached-1.0.18.tar.gz 
[root@localhost solf]# tar xzf memcached-2.2.0.tgz

4、安装libmemcached

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

[root@localhost libmemcached-1.0.18]# make && make install

5、安装PHPmemcached扩展

运行phpize命令生成configure配置文件

[root@localhost memcached-2.2.0]# /usr/local/php/bin/phpize 
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

安装,因为机子上可能没有sasl,这里暂时不启用,加上参数--disable-memcached-sasl,否则--enable-sasl

[root@localhost memcached-2.2.0]# ./configure --with-php-config=/usr/local/php/bin/php-config --disable-memcached-sasl

make && make install

到些安装完成

6、配置php,加载memcahed扩展

extension=memcached.so

7、重启httpd

[root@localhost no-debug-non-zts-20090626]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

8、查看phpinfo

memcached

memcached support enabled
Version 2.2.0
libmemcached version 1.0.18
SASL support no
Session support yes
igbinary support no
json support no
msgpack support no


Directive Local Value Master Value
memcached.compression_factor 1.3 1.3
memcached.compression_threshold 2000 2000
memcached.compression_type fastlz fastlz
memcached.serializer php php
memcached.sess_binary 0 0
memcached.sess_connect_timeout 1000 1000
memcached.sess_consistent_hash 0 0
memcached.sess_lock_expire 0 0
memcached.sess_lock_max_wait 0 0
memcached.sess_lock_wait 150000 150000
memcached.sess_locking 1 1
memcached.sess_number_of_replicas 0 0
memcached.sess_prefix memc.sess.key. memc.sess.key.
memcached.sess_randomize_replica_read 0 0
memcached.sess_remove_failed 0 0
memcached.store_retry_count 2 2


你可能感兴趣的:(为php安装memcached扩展笔记)