mac 搭建lnmp環境

2021-08-21 10:40:32 字數 2016 閱讀 1307

brew 1.5 版本以後將 php 轉至 core 維護。

today i』d like to announce homebrew 1.6.0. the most significant changes since 1.5.0 are `brew install python` installing python 3, the deprecation of homebrew/php and various formula api deprecations.

原來在mac 下建立本地開發環境時,一直都是用的 brew,因為使用方便,既然沒了,那以後要安裝外掛程式要如何安裝呢?

$ brew untap homebrew/tap

echo 'export path="/usr/local/opt/[email protected]/bin:$path"' >> ~/.bash_profile

echo 'export path="/usr/local/opt/[email protected]/sbin:$path"' >> ~/.bash_profile

2. 安裝pear

sudo php -d detect_unicode=0 go-pear.phar

3. 執行以上命令後會進行安裝過程,會有一些配置選項

輸入1,回車,之後複製此路徑->配置pear路徑為:/usr/local/pear

輸入4,回車,之後複製此路徑->配置命令路徑為:/usr/local/bin

4.回車兩次,其他讓其預設,安裝完成

5. 可以通過命令檢查pear安裝是否成功`pear version`

(此 方法沒成功)

強烈建議 mac os x 或者 macos 系統使用者通過 homebrew

包管理器安裝 openresty,像下面這樣:

brew tap openresty/brew

brew install openresty

如果你之前是從

homebrew/nginx

安裝的 openresty,請先執行:

brew untap homebrew/nginx

安裝mysql

brew install [email protected]

配置到環境中

echo 'export path="/usr/local/opt/[email protected]/bin:$path"' >> ~/.bash_profile

source ~/.bash_profile  m

ysql -v

brew link mysql

mysql

報錯error 2002 (hy000): can't connect to local mysql server through socket '/tmp/mysql.sock' (2)

啟動mysql

mysql.server start

mkdir -p ~/library/launchagents

cp /usr/local/cellar/mysql/launchctl load -w ~/library/launchagents/homebrew.mxcl.mysql.plist

登入進入mysql以後,執行

show global variables like 'port';

終端提示

+---------------+-------+

| variable_name | value |

+---------------+-------+

| port | 3306 |

+---------------+-------+

1 row in set (0.01 sec)

可以看到mysql5.7.1的預設埠是3306。

Mac之lnmp環境搭建

之前在windows上開發大部分都是使用的整合環境 xampp,phpstudy,wamp 可以完成日常便捷開發,有些時候卻windows下無法實現的就需要自己搭建虛擬機器,在虛擬機器中搭建lnmp環境,也可以完成開發工作。同樣在mac也會有這兩種選擇,可以使用現成的整合開發環境 mamp 但是使用...

搭建LNMP環境

yum install nginx yserver error page 404 404.html location 40x.html error page 500 502 503 504 50x.html location 50x.html 修改完成後,啟動 nginx nginx此時,可訪問來確...

lnmp環境搭建

lnmp版本 nginx1.12.1 php7.1.8 mysql5.6.37 php和nginx包 提取碼 ggmf 安裝前先安裝依賴 已經安裝了可能會進行公升級,版本完全一致則不會進行任何操作。yum y install bzip2 devel curl devel freetype devel...