php - 无法在 Mac 上使用端口 80
问题描述
我使用的是 macOS Catalina 10.15 版。一开始,我可以使用MAMP PRO和 Port 80。但是,由于缺少PHP的扩展ext-zip,我无法composer install
在项目中运行后,如下所示:/applications/mamp/htdocts/project/
Problem 1
- Installation request for phpoffice/phpspreadsheet 1.10.0 -> satisfiable by phpoffice/phpspreadsheet[1.10.0].
- phpoffice/phpspreadsheet 1.10.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
Problem 2
- phpoffice/phpspreadsheet 1.10.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
- maatwebsite/excel 3.1.17 requires phpoffice/phpspreadsheet ^1.6 -> satisfiable by phpoffice/phpspreadsheet[1.10.0].
- Installation request for maatwebsite/excel 3.1.17 -> satisfiable by maatwebsite/excel[3.1.17].
我决定php
通过homebrew
终端安装。通过以下命令安装成功后
brew install php@7.3
# php -v
PHP 7.3.8 (cli) (built: Aug 24 2019 19:38:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
#which php
/usr/bin/php
结果,我不能再使用端口80的MAMP PRO ,也不能解决缺少扩展ext-zip 的问题。
我有几个问题无法解决:
- 如果
built-in php
一直在那里,我怎么能一开始就使用端口80? - macOS 总是在
built-in php
运行吗?如何知道项目内部正在使用哪个 php?(macOS 或 MAMP)??
我试过的:
- 尝试卸载php
我安装的版本brew uninstall php@7.3 --force
。
解决方案
没有 root 凭据的普通用户无法使用从 1 到 1024 的端口。您可以使用 sudo 绑定到端口 80,但请注意,使用 root 凭据启动程序时可能存在一些安全风险,因此请使用绑定到您的特权端口并将用户凭据放宽到普通用户的包装器.
推荐阅读
- javascript - 将值推送到辅助数组 javascript
- java - 如何转换所有 json 文件。JSON文件的程序读取路径
- udp - coTURN 无法在 Mozilla Firefox 中进行握手
- arrays - 使用数组改变 Excel 公式中偏移量中的行/列
- python - 当应用程序部署在 AWS Beanstalk 上时,Flask catch-all 端点不再工作
- sql - 如何使用 REGEXP-SUBSTR
- ios - 快速从对象数组中删除某些对象
- c# - 如果在 UserControl 上使用 DataTemplate,WPF DependencyProperty OnPropertyChanged 将默认值返回为 NewValue
- apache-kafka - 提交偏移量时,kafka 流会超时
- php - 我已经使用 php 将 csv 导入到表中,但遇到了问题?