Skip to content

Instantly share code, notes, and snippets.

@oxUnd
Last active October 6, 2022 12:24
Show Gist options
  • Save oxUnd/9359739 to your computer and use it in GitHub Desktop.
Save oxUnd/9359739 to your computer and use it in GitHub Desktop.
Mac下安装php-cgi

Mac下安装php-cgi

mac下安装php-cgi有多种方法,这里只介绍比较简单的两个方法;

  • 用brew安装
  • 直接下载安装XAMPP

用brew安装

如果安装了xcode,那么推荐使用brew来安装php。详细使用方法见官网,这里只说明如何装php-cgi;

$ brew install php55 --with-cgi

如果安装提示没有php55,请用 brew tap homebrew/homebrew-php 后再安装

如上,方法很简单,等安装成功后即可使用;

直接下载安装XAMPP

XAMPP官网下载Mac版本,双击安装;等安装成功后需要把XAMPP的bin目录设置到 环境变量里面;

  • 使用zsh

    $ echo 'export PATH=/Applications/XAMPP/bin:$PATH' >> ~/.zshrc
    $ source ~/.zshrc
  • 使用bash

    $ echo 'export PATH=/Applications/XAMPP/bin:$PATH' >> ~/.bashrc
    $ source ~/.bashrc
@hitao123
Copy link

hitao123 commented Aug 7, 2019

@LeuisKen mojava Error: invalid option: --with-cgi

@zsnmwy
Copy link

zsnmwy commented Apr 21, 2020

现在这个安装方法已经不行了。

参考

https://medium.com/@romaninsh/install-php-7-2-xdebug-on-macos-high-sierra-with-homebrew-july-2018-d7968fe7e8b8

macOS Catalina currently bundles PHP 7.3 which is officially supported by the PHP community.

https://medium.com/@romaninsh/macos-high-sierra-with-built-in-php-52bcb5c2398c

@tjcchen
Copy link

tjcchen commented Mar 1, 2021

附上一个XAMPP installer的方式安装,希望有帮助。

链接: https://sourceforge.net/projects/xampp/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment