1. 下载 memcache 源代码文件
https://github.com/websupport-sk/pecl-memcache/archive/php7.zip
文件夹名为: pecl-memcache-php7
2. 解压后进入文件夹执行如下命令
phpize
我执行 phpize 的遇到这个报错
- $ 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:
缺少 PHP 的 header 头文件, 再一看 / usr/include 文件夹根本不存在敲出如下命令:
- $ xcode-select --install
- xcode-select: note: install requested for command line developer tools
如果 phpize 还是无效, 执行下列命令安装 header 头文件 SDK 即可:
- $ cd /Library/Developer/CommandLineTools/Packages/
- $ open macOS_SDK_headers_for_macOS_10.14.pkg
- ./configure --with-PHP-config=/usr/local/opt/PHP\@7.1/bin/PHP-config
PHP-config 修改为指定路径
which PHP-config
3. 执行 make & make install 命令
4, 配置 PHP.INI 加入如下:
extension="memcache.so"
PHP.INI 路径
/private/etc/PHP.INI
来源: http://www.bubuko.com/infodetail-2999333.html