brew php

2022 年 01 月 13 日 • 阅读: 261 • 学习笔记

Install PHP

brew install php@8.0

If you need to have php@8.0 first in your PATH, run:

echo 'export PATH="/opt/homebrew/opt/php@8.0/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@8.0/sbin:$PATH"' >> ~/.zshrc

For compilers to find php@8.0 you may need to set:

export LDFLAGS="-L/opt/homebrew/opt/php@8.0/lib"
export CPPFLAGS="-I/opt/homebrew/opt/php@8.0/include"

The php.ini and php-fpm.ini file can be found in:


If you don't want/need a background service you can just run:

/opt/homebrew/opt/php@8.0/sbin/php-fpm --nodaemonize