Mac 搭建后端PHP+Go环境 - Go语言中文社区

Mac 搭建后端PHP+Go环境


准备工作

1. 安装 安装brew命令

#很慢很慢。。
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

替换国内源:

#下载脚本
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
#替换国内源
BREW_REPO = “https://github.com/Homebrew/brew“.freeze 
BREW_REPO = "https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git".freeze 
#执行
chmod 777 brew_install
./brew_install

安装PHP环境

1.Nginx

• 安装nginx brew install nginx
• 启动nginx sudo nginx
• 访问 http://localhost:8080/

2.安装php

  • 苹果是自带PHP的,如果不是要的版本可以安装其他版本再切换
  • 安装PHP
brew install php72
  • 直接安装7.2然后切换版本(推荐)
brew link php@7.2 --force --overwrite
 echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.bash_profile
 echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.bash_profile
  • 查看php.ini目录
php --ini
php -v 
php -m

3.安装mysql

brew install mysql56

4.更换composer源

最近换了mac好多的用不习惯安装了composer但是下载不了laravel.
执行以下命令再下载laravel

sudo composer config -g repo.packagist composer https://packagist.phpcomposer.com

Go

1.Go编译器安装

  • 官网下载安装包,比较快
  • brew install go
  • 添加环境变量
//编辑~/.bash_profile文件
 vim ~/.bash_profile

//在~/.bash_profile文件中添加以下2条命令
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin

//使配置生效
localhost:~ zxy$ source ~/.bash_profile

2.Goland的配置

参考:https://blog.csdn.net/zxy_666/article/details/80182688
核心步骤:
配置GoPath
在这里插入图片描述

其他软件

1.抓包破解

Registered Name:  https://zhile.io
License Key:  48891cf209c6d32bf4

2.phpStrom

汉化:
点击应用程序–>右击PhpStorm选择显示包内容–>Contents–>lib
版权声明:本文来源CSDN,感谢博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/happy_teemo/article/details/100938988
站方申明:本站部分内容来自社区用户分享,若涉及侵权,请联系站方删除。

0 条评论

请先 登录 后评论

官方社群

GO教程

猜你喜欢