• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

Mac Brew 安装PHP

武飞扬头像
多动手,勤思考
帮助1

1. 默认镜像源安装太慢或发生包not found,第一步切换镜像源为阿里云

其他更多的源参考:Mac 下 brew 切换为国内源 - 腾讯云开发者社区-腾讯云

注意:使用了国内的源之后注意命令行的外网vpn代理就不要开启了,防止卡住

  1.  
    # 查看 brew.git 当前源
  2.  
    $ cd "$(brew --repo)" && git remote -v
  3.  
    origin https://github.com/Homebrew/brew.git (fetch)
  4.  
    origin https://github.com/Homebrew/brew.git (push)
  5.  
     
  6.  
    # 查看 homebrew-core.git 当前源
  7.  
    $ cd "$(brew --repo homebrew/core)" && git remote -v
  8.  
    origin https://github.com/Homebrew/homebrew-core.git (fetch)
  9.  
    origin https://github.com/Homebrew/homebrew-core.git (push)
  10.  
     
  11.  
    # 修改 brew.git 为阿里源
  12.  
    $ git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
  13.  
     
  14.  
    # 修改 homebrew-core.git 为阿里源
  15.  
    $ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
  16.  
     
  17.  
    # zsh 替换 brew bintray 镜像
  18.  
    $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
  19.  
    $ source ~/.zshrc
  20.  
     
  21.  
    # bash 替换 brew bintray 镜像
  22.  
    $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
  23.  
    $ source ~/.bash_profile
  24.  
     
  25.  
    # 刷新源
  26.  
    $ brew update
学新通

2. 安装php

参考:macOS 使用 Homebrew 安装 PHP7.4 并替代系统自带 PHP 教程 - 知乎

  1.  
    # 搜索php
  2.  
    brew search php
  3.  
     
  4.  
    # 安装php7.4
  5.  
    brew install php@7.4
  6.  
     
  7.  
    # 在PATH中追加php
  8.  
    export PATH="/usr/local/opt/php@7.4/bin:$PATH"

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhgegbic
系列文章
更多 icon
同类精品
更多 icon
继续加载