PHP安装memcached扩展

安装GCC

sudo yum -y install gcc

安装libevent

下载libevent

wget https://github.com/libevent/libevent/releases/download/release-2.0.22-stable/libevent-2.0.22-stable.tar.gz

解压文件

tar -zvxf libevent-2.0.22-stable.tar.gz

进入目录

cd libevent-2.0.22-stable

配置

./configure --prefix=/usr/local

编译

make

安装

make test && make install

安装memcached

下载memcached

wget http://memcached.org/files/memcached-1.4.25.tar.gz

解压文件

tar -zvxf memcached-1.4.25.tar.gz

进入目录

cd memcached-1.4.25

配置

./configure --prefix=/usr/local --with-libevent=/usr/local

编译

make

安装

make test && make install

安装php memcache扩展

下载源码

wget http://pecl.php.net/get/memcache-2.2.7.tgz

解压

tar -zvxf memcache-2.2.7.tgz

进入目录

cd memcache-2.2.7

配置

/data/local/php/bin/phpize
./configure --enable-memcache=/usr/local/memcached --with-php-config=/usr/local/php/bin/php-config

编译

make

安装

make test && make install

修改php配置

添加一行代码

extension=memcache.so

查看配置

/usr/local/php/bin/php -m | grep memcache

results matching ""

    No results matching ""