买 Mac Pro 的时候,系统为 OS X 10.11.5,编译 PHP-5.6.21 的时候,也遇到一些坑,安装过程记录如下:

Mac Pro 编译安装 PHP 5.6.21 及 问题汇总

后来,系统升级为 OS X 10.11.6,再后来,打算升级  PHP 至 5.6.28,报错:

报错1

./configure 时报错

conftest.c:9:10: fatal error: 'ac_nonexistent.h' file not found

解决

再次升级到最新的苹果系统 OS Sierra 10.12.1

报错2

configure: error: Cannot find libz

试着解决

执行 sudo brew install libz,继续报错:

报错3

Error: No available formula with the name "libz"
==> Searching for similarly named formulae...
These similarly named formulae were found:
libzdb libzip libzzip
To install one of them, run (for example):
brew install libzdb
==> Searching taps...
Error: No formulae found in taps.
==> You haven't updated Homebrew in a while.
A formula for libz might have been added recently.
Run `brew update` to get the latest Homebrew updates!

按照提示,执行 brew update,继续报错:

报错4

/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
/usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory
[etc..]
Error: update-report should not be called directly!

参考国外的网站,homebrew-error-update-report-should-not-be-called-directly

解决

cd /usr/local; git reset --hard origin/master; brew update

继续执行,brew update,继续报错:

报错5

Error: /usr/local must be writable!

执行 sudo brew update,继续报错:

报错6

Error: Cowardly refusing to 'sudo brew update'
You can use brew with sudo, but only if the brew executable is owned by root.
However, this is both not recommended and completely unsupported so do so at
your own risk.

好吧,修改 /usr/local/ 文件夹的权限(用户)

sudo chown -R $(whoami) /usr/local

再次执行 brew update,这条语句没报错!

继续解决 Cannot find libz 的问题,执行: brew install libz,报错

报错7

Error: No available formula with the name "libz" 
==> Searching for similarly named formulae...
These similarly named formulae were found:
libzdb                             libzip                             libzzip
To install one of them, run (for example):
  brew install libzdb
==> Searching taps...
Error: No formulae found in taps.

后来,找到一个帖子,Cannot find libz when install php56,找到解决方案

解决

执行

xcode-select --install
brew upgrade

PHP-5.6 继续执行,./configure ,没报错!

./configure \
--prefix=/usr/local/php/php-5.6 \
--with-config-file-path=/usr/local/php/php-5.6/etc \
--with-openssl=/usr/local/opt/openssl \
--with-zlib \
--with-bz2 \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-gettext \
--with-mhash \
--with-freetype-dir \
--with-mcrypt \
--with-iconv \
--with-curl \
--with-xmlrpc \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--enable-calendar \
--enable-pdo \
--enable-zip \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--enable-soap \
--enable-sockets \
--enable-ftp \
--enable-gd-native-ttf \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-xml \
--enable-pcntl \
--enable-fpm \
--enable-opcache \
--without-pear

PHP-7.0

./configure \
--prefix=/usr/local/php/php-7.0 \
--with-config-file-path=/usr/local/php/php-7.0/etc \
--with-openssl=/usr/local/opt/openssl \
--with-zlib \
--with-bz2 \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-gettext \
--with-mhash \
--with-freetype-dir \
--with-mcrypt \
--with-iconv \
--with-curl \
--with-xmlrpc \
--with-pdo-mysql \
--with-mysqli \
--enable-calendar \
--enable-pdo \
--enable-zip \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--enable-soap \
--enable-sockets \
--enable-ftp \
--enable-gd-native-ttf \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-xml \
--enable-pcntl \
--enable-fpm \
--enable-opcache \
--without-pear

执行 make 的时候会报错,参考 以前的文章,即可解决:

Mac Pro 编译安装 PHP 5.6.21 及 问题汇总

执行 make 操作的时候,又报错:

/usr/lib/libiconv.dylib /usr/local/lib/libiconv.dylib -o sapi/cli/php
ld: can't write output file: sapi/cli/php for architecture x86_64

提示不能写入,应该是权限的问题,进入源码包的,查看文件 ./sapi/cli/php 文件,所属用户为 root,果然是权限问题,执行 make 的时候,sudo 一下,即 sudo make,大功告成。


按照同样的方式,编译安装了 PHP-7.0,并实现了 PHP 多版本的 共存 和 切换

如何 实现PHP多版本的 共存 和 切换?

延伸阅读:

Mac Pro 编译安装 PHP 5.6.21 及 问题汇总

记 Mac 升级后,编译安装 PHP-5.6.28 / PHP-7.0 报错修复过程

记 Mac Pro 系统升级后,编译安装 PHP-5.6.28 / PHP-7.0 报错修复过程的更多相关文章

  1. mac下使用opencv编译安装新模块contrib

    opencv-4.0.1 opencv_contrib-4.0.1 提供ippicv下载链接: https://pan.baidu.com/s/1OIJRUqPqAtpMetku8qX36w cont ...

  2. TensorFlow Android Camera Demo 使用android studio编译安装和解决Execution failed for task ':buildNativeBazel'报错

    可以参考官网:https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android#android-stud ...

  3. 打开安装 好的Microsoft Dynamics CRM 4.0 报错误为 Caller does not have enough privilege to set CallerOriginToken to the specified value 的解决办法

    If you installed CRM 4.0 on box where you also have SQL and used a domain account as service account ...

  4. Mac Pro 软件安装/个性化配置 汇总

    苹果产品维修 一.Spotlight 搜索程序和文档 Spotlight是最最常用的东西, 类似Windows开始菜单中的搜索.  可以用来搜索文档,也可以搜索本机的程序, 这样可以快速启动. 点击右 ...

  5. [实践] ubuntu下编译安装ambari

    ambari是一个Hadoop套件的管理工具,可以方便部署.管理及监控.最初开发时使用的就是RH系的Linux,只支持RHEL.CentOS5/6.OEL.SLES,暂不支持Ubuntu:可我的需求就 ...

  6. Linux下编译安装Apache Http Server

    Linux下编译安装Apache Http Server [TOC] 1.下载httpd-2.4.12.tar.bz2 wget http://mirror.bit.edu.cn/apache/htt ...

  7. Centos6.5下编译安装ACE6.0

    ACE在Linux下的编译安装步骤(CentOS6.5 64Bit) Linux平台安装(CentOS6.5 64bit) 1, 下载ACE软件包,上传至Linux服务器(假设目录为/opt/ace, ...

  8. CentOS 6.5 简单编译安装Nginx

    一.准备工作 现在官网下载需要的nginx版本:http://nginx.org/en/download.html 从linux服务器上下载,或者本地电脑下载导入服务都行 这里我选择安装的是nginx ...

  9. Centos6.4 编译安装 nginx php

    一. 准备依赖库 安装make: yum -y install gcc automake autoconf libtool make 安装g++: yum install gcc gcc-c++ 二. ...

随机推荐

  1. POJ3070 Fibonacci[矩阵乘法]

    Fibonacci Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 13677   Accepted: 9697 Descri ...

  2. iOS 2D绘图 (Quartz2D)之路径(stroke,fill,clip,subpath,blend)

    像往常一样 这个系列的博客是跟着大神的脚步来的.按照往例 在此贴出原博客的出处: http://blog.csdn.net/hello_hwc?viewmode=list我对大神的崇拜之情 如滔滔江水 ...

  3. C# ASP.NET 优化程序性能、降低内存使用、提高程序运行速度

    首先纪念一下今天的股票大跌抓个图,虽然我自己损失不是很大,但是应该大多人都损失不小.也可能有人会继续跳楼,也可能是股市一个新的转折点来了. 接着还是重点关注自己写代码优化的主题吧.软件系统当访问量不大 ...

  4. ZH奶酪:自然语言处理工具LTP语言云调用方法

    前言 LTP语言云平台 不支持离线调用: 支持分词.词性标注.命名实体识别.依存句法分析.语义角色标注: 不支持自定义词表,但是你可以先用其他支持自定义分词的工具(例如中科院的NLPIR)把文本进行分 ...

  5. knockoutJS学习笔记04:监控属性

    一.语法介绍 先来看一个简单的例子: <span data-bind="text:name"></span> var obj = {name:ko.obse ...

  6. 用上CommonMark.NET,.NET平台终于有了好用的markdown引擎

    缺少好用的markdown引擎之前一直是.NET平台上的一个痛点.因为这个痛点,我们被迫痛苦地使用了pandoc--不是pandoc做的不好,而是pandoc是由Haskell开发的,只能在Windo ...

  7. 微信快速开发框架(九)-- V3.0发布,代码已更新至Github 新增微店功能

    版本内容 1.修正了缺少对Event.View的支持 2.增加了用户UnionID 3.新增微信小店功能 4.多客服功能 5.单元测试 什么是UnionID 我们知道,每个用户针对一个微信公众账号都有 ...

  8. C 语言学习 第三次作业总结

    本次作业内容: For循环的使用 If判断语句的使用 常用数学运算表达式的使用 数学函数库中几个常见函数的使用及自我实现 将操作代码提交到coding 作业总结: For循环是C语言中一种基本的循环语 ...

  9. 【转】Java中try catch finally语句中含有return语句的执行情况(总结版)

    Java中try catch finally语句中含有return语句的执行情况(总结版) 有一点可以肯定,finally块中的内容会先于try中的return语句执行,如果finall语句块中也有r ...

  10. sp_executeSql 用法

    今天遇到了一个难题 就是把 一个拼接sql语句 的返回值 赋值给一个变量 经研究 要用sp_executeSql这个存储过程 据说是从sql 2005才开始有的 代码如下: declare @str ...