brew tap shivammathur/php
brew install shivammathur/php/php@7.2
标题安装完成后会提示以下信息:
The php.ini and php-fpm.ini file can be found in:/usr/local/etc/php/7.2/
php@7.2 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.If you need to have php@7.2 first in your PATH,run:echo'export PATH="/usr/local/opt/php@7.2/bin:$PATH"'>>~/.zshrc
echo'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"'>>~/.zshrc
For compilers to find php@7.2 you may need to set:
export LDFLAGS="-L/usr/local/opt/php@7.2/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.2/include"
To start shivammathur/php/php@7.2 now and restart at login:
brew services start shivammathur/php/php@7.2Or,if you don't want/need a background service you can just run:
/usr/local/opt/php@7.2/sbin/php-fpm --nodaemonize
==> openjdk@11
For the system Java wrappers to find this JDK, symlink it with
sudo ln -sfn /usr/local/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk
openjdk@11 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have openjdk@11 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openjdk@11/bin:$PATH"' >>~/.zshrc
For compilers to find openjdk@11 you may need to set:
export CPPFLAGS="-I/usr/local/opt/openjdk@11/include"==> scrcpy
At runtime, adb must be accessible from your PATH.
You can install adb from Homebrew Cask:
brew install --cask android-platform-tools
zsh completions have been installed to:/usr/local/share/zsh/site-functions
这里面有几个重要信息:
// 1. php.ini 路径在/usr/local/etc/php/7.2/// 2. 确保已经添加环境变量echo'export PATH="/usr/local/opt/php@7.2/bin:$PATH"'>>~/.zshrc
echo'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"'>>~/.zshrc
// 3. 供编译器查找php@7.2需要确保以下设置
export LDFLAGS="-L/usr/local/opt/php@7.2/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.2/include"// 4. 此时可验证php是否安装成功
$ php -v
PHP7.2.34 (cli)(built: Mar 31202508:08:00)(NTS)Copyright (c)1997-2018 The PHP Group
Zend Engine v3.2.0,Copyright (c)1998-2018 Zend Technologies
with Zend OPcache v7.2.34,Copyright (c)1999-2018, by Zend Technologies
// 5. 启动、停止、重启php7.2// 查询运行状态
$ brew services list|grep php
php@7.2 started smt ~/Library/LaunchAgents/homebrew.mxcl.php@7.2.plist
// 启动
$ brew services start shivammathur/php/php@7.2==> Successfully started `php@7.2`(label: homebrew.mxcl.php@7.2)// 重启
$ brew services restart shivammathur/php/php@7.2
Stopping `php@7.2`...(might take a while)==> Successfully stopped `php@7.2`(label: homebrew.mxcl.php@7.2)==> Successfully started `php@7.2`(label: homebrew.mxcl.php@7.2)// 停止
$ brew services stop shivammathur/php/php@7.2
Stopping `php@7.2`...(might take a while)==> Successfully stopped `php@7.2`(label: homebrew.mxcl.php@7.2)