美文网首页
Mac 安装PHP运行环境

Mac 安装PHP运行环境

作者: Mookeen | 来源:发表于2019-12-21 20:44 被阅读0次
1、安装homebrew

ruby -e "$(curl -fsSL [https://raw.githubusercontent.com/Homebrew/install/master/install](https://raw.githubusercontent.com/Homebrew/install/master/install))”

brew常用命令
brew update                        #更新brew可安装包,建议每次执行一下

brew search php55                  #搜索php5.5

brew tap josegonzalez/php          #安装扩展<gihhub_user/repo>   

brew tap                           #查看安装的扩展列表

brew install php55                 #安装php5.5

brew remove  php55                 #卸载php5.5

brew upgrade php55                 #升级php5.5

brew options php55                 #查看php5.5安装选项

brew info    php55                 #查看php5.5相关信息

brew home    php55                 #访问php5.5官方网站

更换科大源「国外源慢可以更换」
替换brew.git:
cd "$(brew --repo)"

git remote set-url origin [https://mirrors.ustc.edu.cn/brew.git](https://mirrors.ustc.edu.cn/brew.git)

//替换homebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin [https://mirrors.ustc.edu.cn/homebrew-core.git](https://mirrors.ustc.edu.cn/homebrew-core.git)

1.重置源

cd "$(brew --repo)"

git remote set-url origin [https://github.com/Homebrew/brew.git](https://github.com/Homebrew/brew.git)

//重置homebrew-core.git:

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin [https://github.com/Homebrew/homebrew-core.git](https://github.com/Homebrew/homebrew-core.git)

安装完成后查看brew help看到已安装完成

2、安装Nginx
//查看版本已有版本

brew search Nginx

//『在此安装的nginx1.17.6版本』

brew install nginx

安装完成后如下代码

Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that

nginx can run without sudo.

nginx will load all files in /usr/local/etc/nginx/servers/.

To have launchd start nginx now and restart at login:

  brew services start nginx

Or, if you dont want/need a background service you can just run: 

nginx

文件目录:/usr/local/var/www
配置文件:/usr/local/etc/nginx/nginx.conf
虚拟配置:/usr/local/etc/servers/
后台启动:brew services start nginx

验证nginx启动成功:http://localhost:8080(8080端口不需要sudo即可)

3、安装MySQL

brew search mysql

安装MySQL5.7
brew install mysql@5.7

We've installed your MySQL database without a root password. To secure it run:

We've installed your MySQL database without a root password. To secure it run:

mysql_secure_installation

MySQL is configured to only allow connections from localhost by default

To connect run:

    mysql -uroot

mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,

because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run:

  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.bash_profile

For compilers to find mysql@5.7 you may need to set:

  export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"

  export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"

To have launchd start mysql@5.7 now and restart at login:

  brew services start mysql@5.7

Or, if you don't want/need a background service you can just run:

  /usr/local/opt/mysql@5.7/bin/mysql.server start

==>Summary🍺  /usr/local/Cellar/mysql@5.7/5.7.28: 318 files, 232.5MB, built in 17 minutes 31 seconds

相关文章

  • Mac 安装PHP运行环境

    1、安装homebrew ruby -e "$(curl -fsSL [https://raw.githubuse...

  • docker安装php环境

    docker安装php运行环境 php的运行环境主要有php,mysql,nginx,redis 首先安装ngin...

  • php聊天室(swoole/redis)

    环境Mac OS 10.10php环境 xamppPHP7.0安装swoole/redis扩展安装php扩展php...

  • mac 配置相关

    ①mac php版本切换 ②修改 Mac 默认 PHP 运行环境,给 MAMP 配置全局 Composer ③Up...

  • Mac 配置php环境

    工具:brew,好用的Mac安装软件的工具 一、安装php环境 Mac自带了php环境,但是无论从版本、功能还是开...

  • PHP的学习

    PHP运行领域 。 PHP运行环境 PHP网页运行原理 安装apache 配置apache以运行PHP程序 用法1...

  • Mac php 配置

    在Mac系统下配置PHP运行环境 PHP.png 概述 Mac系统对于PHP运行非常友好,我们只需要进行简单的配置...

  • 1.Laravel环境搭建—Mac + Php + Nginx

    目录 1.1 Mac PHP 升级 1.2 Mac Nginx 安装 1.3 Laravel安装 1.4 打通环境...

  • MAMP 编译安装php扩展

    本文主要介绍 MAC 环境下,MAMP PRO 集成环境,php扩展的安装,下面以php版本5.6安装redis ...

  • CentOS6.6下配置LAMP环境

    CentOS配置PHP运行环境,即LAMP yum安装apache服务器yum安装PHP环境yum安装MySQLM...

网友评论

      本文标题:Mac 安装PHP运行环境

      本文链接:https://www.haomeiwen.com/subject/eytnnctx.html