1. 程式人生 > >mac安裝php開發環境

mac安裝php開發環境

安裝xcode:
從App Store搜尋下載xcode,自動安裝。

安裝homebrew:
去官網brew.sh,有最新下載地址,貼上到終端即可,需要先有xcode。

安裝mysql:
用homebrew安裝,只需要一條命令即可,brew install mysql。

apache:
ios內建了apche伺服器,直接可以開啟服務。開啟終端,切到root使用者,sudo -i。
啟動命令 sudo apchectl start
關閉命令 sudo apchectl stop
重啟命令 sudo apchectl restart
檢視版本命令 httpd -v
apache預設根目錄 /Library/WebServer/Documents

命令:
1. 切換使用者
taiwu使用者切換到root使用者:sudo -i
root使用者切回到taiwu使用者:su - taiwu

2. 
查詢用brew已經安裝的應用: brew list
查詢brew能安裝的: brew search php56


 

使用brew安裝php56:

brew install homebrew/php/php56 --with-mssql --with-homebrew-openssl --with-homebrew-libxslt --with-homebrew-curl --with-fpm --with-debug --with-gmp --with-imap --with-tidy --with-libmysql


brew install homebrew/php/php53 --with-mssql --with-homebrew-openssl --with-homebrew-libxslt --with-homebrew-curl --with-fpm --with-debug --with-gmp --with-imap --with-tidy --with-libmysql
brew安裝完php56後,看說明:
php配置檔案地址: /usr/local/etc/php/5.6/php.ini

修改配置檔案 php-fpm.conf
監聽埠修改 127.0.0.1:9056
daemonize = yse

sudo ./php56-fpm start