mac php memcache 扩展,MAC安装PHP扩展之MEMCACHE的例子

在执行phpize的时候,出现错误提示

grep: /usr/include/php/main/php.h: No such file or directory

grep: /usr/include/php/Zend/zend_modules.h: No such file or directory

grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory

Configuring for:

PHP Api Version:

Zend Module Api No:

Zend Extension Api No:

Cannot find autoconf. Please check your autoconf installation and the

$PHP_AUTOCONF environment variable. Then, rerun this script.

1.由于/usr/include目录不存在,所以需要执行命令

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/ /usr/include

2.系统没有安装autoconf所以需要安装之,此项可参考http://blog.wwllcchf.com/?p=260

安装php扩展还可以按照以下方法

为了扩展管理方便,首先来安装pecl扩展管理器:

cd /usr/lib/php

sudo php install-pear-nozlib.phar

安装Redis、Memcache、Mongo等扩展。

sudo pecl install redis

sudo pecl install memcache

sudo pecl install mongo

sudo pecl install xdebug

将扩展配置添加的php.ini文件中:

extension=memcache.so

extension=mongo.so

extension=redis.so

zend_extension=xdebug.so

安装xcache,从官网下载Release-3.2.0解压缩并安装

tar xvf xcache-3.2.0.tar

cd xcache-3.2.0

phpize

/configure

make

sudo make install

配置XCache

[xcache]

xcache.size = 128M

xcache.var_size = 8M

xcache.var_count = 1

xcache.var_slots = 8K

xcache.var_ttl = 0

xcache.var_maxttl = 0

xcache.var_gc_interval = 300

xcache.optimizer = Off

由于Mac自带的PHP环境是不包括mcrypt扩展的,所以需要下载同版本的php源码包,单独编译这个模块加载。从官网的归档里面找到php5.5.14的源码包,下载:http://php.net/releases/

tar zxvf php-5.5.14.tar.gz

cd php-5.5.14/ext/mcrypt/

phpize

。/configure

make

sudo make install

配置ext-mcrypt

extension=mcrypt.so

为了加速,还需要打开opcache。

zend_extension=opcache.so

[opcache]

; Determines if Zend OPCache is enabled

opcache.enable=0

; Determines if Zend OPCache is enabled for the CLI version of PHP

opcache.enable_cli=0

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值