mac os lion 编译安装php memcache 扩展

mac os lion 系统默认安装了apache和php,若是要在php中使用memcached,就须要本身安装扩展。本文采用源码方式来安装。php扩展有两种,一个是memcache,一个是memcached,下载地址为:
memcache:http://pecl.php.net/package/memcache
memcached:http://pecl.php.net/package/memcached
安装memcached,就须要安装先libmemcached,这里安装的是memcache。 php

在上述连接中选择下载一个源码,例如:memcache-2.2.6.tgz,解压并进入解压目录,先执行phpize,本人系统出现以下错误: apache

Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

缘由是系统没有安装autoconf,解决办法下载autoconf的源码,本身编译安装。autoconf的官方网址是:http://www.gnu.org/software/autoconf/。安装命令以下: curl

cd ~
mkdir tmp
cd tmp
curl http://ftp.gnu.org/gnu/autoconf/autoconf-2.68.tar.bz2 -o autoconf-2.68.tar.bz2
tar -xvf autoconf-2.68.tar.bz2
cd autoconf-2.68
./configure && make
sudo make install

安装好autoconf,下面就能够开始安装memcache扩展了,安装命令以下: memcached

cd ~
mkdir tmp
cd tmp
curl http://pecl.php.net/get/memcache-2.2.6.tgz -o memcache-2.2.6.tgz
tar -xvf memcache-2.2.6.tgz
cd memcache-2.2.6
sudo phpize
sudo ./configure
sudo make
sudo make install

若是看到相似以下输出: this

Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20090626/

表示编译成功。最后还须要修改php.ini,把以下信息添加进去: url

extension=memcache.so

至此,php memcache扩展就编译安装成了,重启apache服务,就能够在php中使用memcache。 .net

相关文章
相关标签/搜索