php7.1编译安装

1.安装必要的工具:

bash 复制代码
首先确保您已经安装了 Xcode 和 Command Line Tools:
bash 复制代码
xcode-select --install

2.下载 PHP 7.1 源代码:

访问 PHP 官方网站下载 PHP 7.1 的源代码:

bash 复制代码
wget https://www.php.net/distributions/php-7.1.33.tar.gz
tar -zxvf php-7.1.33.tar.gz
cd php-7.1.33

3.配置并编译 PHP:

bash 复制代码
./configure --prefix=/usr/local/php71
make
sudo make install

4.添加 PHP 到 PATH:

将 PHP 7.1 添加到您的 PATH 中以便可以在命令行中访问它:

bash 复制代码
echo 'export PATH="/usr/local/php71/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

5.验证安装:

bash 复制代码
php -v

问题汇总:

先安装liviconv,再继续编译

bash 复制代码
./configure --prefix=/Users/luzhifang/php/php-7.3.4/output/ --enable-fpm --enable-debug --with-iconv=/usr/local/opt/libiconv/

https://zhuanlan.zhihu.com/p/370921434

bash 复制代码
Generating phar.php
Generating phar.phar
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
directorytreeiterator.inc
clicommand.inc
directorygraphiterator.inc
invertedregexiterator.inc
pharcommand.inc
make: *** [ext/phar/phar.phar] Segmentation fault: 11

解决办法:编译参数增加 --without-pear --disable-phar

./configure --without-pear --disable-phar --with-iconv=/usr/local/opt/libiconv/ --prefix=/Users/null/work/php/php-7.1.0/output --enable-fpm

vim Makefile // 修改 Makefile,-liconv -liconv 改成 -liconv /usr/local/opt/libiconv/lib/libiconv.dylib

make clean

make && make install

相关推荐
Bruce_Liuxiaowei5 小时前
PHP文件读取漏洞全面剖析:触发点与利用技术
开发语言·php
hopetomorrow7 小时前
学习路之PHP--webman安装及使用
android·学习·php
链上Sniper21 小时前
Python 区块链开发实战:从零到一构建智能合约
开发语言·网络·python·架构·区块链·php·智能合约
链上Sniper1 天前
智能合约安全漏洞解析:从 Reentrancy 到 Integer Overflow
开发语言·网络·架构·区块链·php·智能合约
链上Sniper1 天前
高并发区块链系统实战:从架构设计到性能优化
开发语言·网络·python·性能优化·架构·区块链·php
链上Sniper1 天前
NFT 市场开发:基于 Ethereum 和 IPFS 构建去中心化平台
开发语言·网络·架构·去中心化·区块链·php
链上Sniper1 天前
区块链跨链通信:使用 Cosmos SDK 实现链间互操作
开发语言·网络·架构·区块链·php
时之彼岸Φ1 天前
网络攻防技术十四:入侵检测与网络欺骗
开发语言·网络·php
搬码临时工1 天前
有公网ip但外网访问不到怎么办?内网IP端口映射公网连接常见问题和原因
运维·服务器·网络·网络协议·tcp/ip·php·远程工作
落华X2 天前
windows安装多个版本composer
php·composer