1. 程式人生 > >Mac brew 升級 php7.2 並設定為預設

Mac brew 升級 php7.2 並設定為預設

mac 升級PHP 到 7.2

whereis php 
php -v

系統預設自帶的是 PHP5.6,需要升級到最新版本 PHP7.2

brew install php72
brew info php72
brew --prefix php

中途可能要升級 xcode-select

修改 ~/.bash_profile

user:~ sl$ cat ~/.bash_profile 

# The original version is saved in .bash_profile.pysave
PATH="$(brew --prefix php)/bin:$PATH"
export PYTHON_ENV=development user:~ sl$ source ~/.bash_profile user:~ sl$ php -v user:~ sl$ php -v PHP 7.2.9 (cli) (built: Aug 23 2018 02:10:05) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.2.9, Copyright (c) 1999-2018
, by Zend Technologies user:~ sl$