bash ./php-memcache.sh,linux下安装PHP扩展:Memcache

一、所需资源

1、Memcache : http://pecl.php.net/package/memcache

二、从源码安装

注:

php的安装目录是: /usr/local/php

zlib的安装目录是: /usr/local/zlib

1、安装memcache

#下载解压wget-c http://pecl.php.net/get/memcache-3.0.6.tgz

tar xzvf memcache-3.0.6.tgz

cd memcache-3.0.6

#配置/usr/local/php/bin/phpize

./configure--enable-memcache--with-php-config=/usr/local/php/bin/php-config--prefix=/usr/local/memcache/--with-zlib-dir=/usr/local/zlib

make&&make

install

如遇到错误: Cannot find autoheader. Please check your autoconf

installation and the

$PHP_AUTOHEADER environment variable. Then, rerun this script.

请看下面(三、1)

如遇到错误:error: too few arguments to function

‘zend_list_insert’请看下面(三、2)

安装完后会有类似这样的提示:

Installing shared extensions:

/usr/local/php/lib/php/extensions/no-debug-non-zts-20060922/

把这个记住,在修改php.ini时用到

#最后修改php.ini文件,在zend之前加入如下代码。[memcache]

extension_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060922/"

extension=memcache.so

重启服务,安装完毕

三、遇到错误

1、: Cannot find autoheader. Please check your autoconf installation

and the

$PHP_AUTOHEADER environment variable. Then, rerun this script.

解决:

wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.gz

tar-zxvf autoconf-2.65.tar.gz

cd autoconf-2.65

./configure--prefix=/usr/local/autoconf

make&&make

install

export PHP_AUTOCONF=/usr/local/autoconf/bin/autoconf

export PHP_AUTOHEADER=/usr/local/autoconf/bin/autoheader

2、遇到 error: too few arguments to function ‘zend_list_insert’

这个是什么原因呢,回去看看configure的时候有什么警告没。这里果然有个警告:

configure: WARNING: You will need re2c 0.13.4 or later if you want

to regenerate PHP parsers.

解决:

打开memcache.c文件,

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

改为:zend_list_insert(pool, le_memcache_pool TSRMLS_CC);

保存,退出继续编译,成功搞定!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值