记在mac上安装php7

./configure时遇到的问题:

libxml 不存在: 解决加上 LIBXML_CFLAGS=-I/usr/local/opt/libxml2/include LIBXML_LIBS=-L/usr/local/opt/libxml2/lib 解决掉

sqlite3 不存在:SQLITE_CFLAGS=-I/usr/local/opt/sqlite3/include SQLITE_LIBS=-L/usr/local/opt/sqlite3/lib

iconv 不存在:--with-iconv=/usr/local/opt/libiconv

 备注:/usr/local/opt/libxml2是brew安装libxml时的路径,默认都是这样的。其他路径同理。

make时遇到的问题:

fatal error: 'libxml/parser.h':  主要是找不到这个文件,正常类unix的系统默认的include目录都在/usr/include 这个路径,也就是如果是如果有/usr/include目录做个软连接进来就可以了,如:

ln -s /usr/include/libxml2/libxml /usr/include/libxml,可惜macos移除了。
那我们就想办法安装回来:
macos mojave:
xcode-select --install
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
macos catalina:
#command+R 进入恢复模式后关闭SIP。修改完成后建议启用。
csrutil disable
#已安装可以无视
xcode-select --install
#根目录挂载为可读写
sudo mount -uw /
#建立软链
sudo ln -s "$(xcrun --show-sdk-path)/usr/include" /usr/include
#然后把做个软连接: ln -s "
$(xcrun --show-sdk-path)/usr/include/libxml2/libxml" /user/include/libxml
说明:x
crun --show-sdk-path : 新的macos sdk 的include路径。

 

参考:

https://blog.csdn.net/Tuine/article/details/87858745

posted @ 2020-05-12 16:59  luffy_zhong  阅读(438)  评论(0编辑  收藏  举报