安裝Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
之后就可以使用
brew install ****
來(lái)安裝所需要的依賴了三幻。
安裝PHP7.1(FPM方式)
brew install php@7.1
由于OSX已經(jīng)自帶了PHP環(huán)境呐能,因此需要修改系統(tǒng)路徑,優(yōu)先運(yùn)行brew安裝的版本摆出,在~/.bashrc
里加入:
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
PHP-FPM的加載與啟動(dòng)
安裝完畢后可以通過(guò)以下指令啟動(dòng)和停止php-fpm
php-fpm -D
killall php-fpm
安裝Nginx
brew install nginx
安裝完畢后可以通過(guò)
nginx
nginx -s quit
啟動(dòng)和關(guān)閉,同時(shí)也支持重載配置文件等操作
nginx -s reload|reopen|stop|quit
此時(shí)啟動(dòng)了php-fpm并且啟動(dòng)了Nginx后爷恳,就可以通過(guò)http://localhost來(lái)運(yùn)行php程序了
安裝擴(kuò)展
使用pecl的方式安裝
/usr/local/Cellar/php\@7.1/7.1.23/pecl install redis
/usr/local/Cellar/php\@7.1/7.1.23/pecl install mongodb
/usr/local/Cellar/php\@7.1/7.1.23/pecl install memcahced
安裝好后直接使用象踊,不需要配置php.ini文件(已經(jīng)自動(dòng)配置好了_)。