Mac安裝PHP環(huán)境
1、安裝brew
/bin/zsh -c "$(curl -fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
選擇1中科大源根據(jù)提示完成安裝
2毁葱、安裝nginx
brew install nginx
3隶症、安裝mysql
brew install mysql
4逐样、安裝PHP
#查看可安裝版本
brew search php
#存在7.4仗哨,安裝之
brew install php@7.4
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
source ~/.zshrc
5晚吞、安裝phpredis拓展
https://www.cnblogs.com/ihuangjianxin/p/10185266.html
進(jìn)入php官網(wǎng)下載redis擴(kuò)展下載擴(kuò)展
#http://pecl.php.net/package/redis
解壓安裝包
tar -xzvf redis-4.*.tgz
通過(guò)phpize生成編譯configure配置文件
cd redis-4.*/
phpize
./configure --with-php-config=/usr/local/opt/php\@7.*/bin/php-config
編譯
make
make install
配置 php.ini文件
文件位置:/usr/local/etc/php/7.2/php.ini文件內(nèi)容添加下面這行
extension="redis.so"
重啟PHP完成安裝
6桥言、安裝redis
brew installredis
到此簡(jiǎn)單記錄下Mac安裝PHP環(huán)境的過(guò)程萌踱,后續(xù)有時(shí)間再豐富一下細(xì)節(jié)內(nèi)容。更多相關(guān)信息号阿,請(qǐng)關(guān)注微信公眾號(hào):技術(shù)大番薯并鸵。不定期更新。