Skip to content

Instantly share code, notes, and snippets.

@cat-kun
Forked from oxUnd/install-php.md
Created July 2, 2018 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cat-kun/b278ceb02dee53ba61a95a3204da819c to your computer and use it in GitHub Desktop.
Save cat-kun/b278ceb02dee53ba61a95a3204da819c 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment