1. 安装
brew search php
brew install php@x.x
brew install phpmyadmin
2. 启动
2.1安装日志解读
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set php_ini /usr/local/etc/php/7.4/php.ini system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set php_dir /usr/local/share/pear@7.4 system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set doc_dir /usr/local/share/pear@7.4/doc system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20190902 system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set bin_dir /usr/local/opt/php@7.4/bin system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set data_dir /usr/local/share/pear@7.4/data system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set cfg_dir /usr/local/share/pear@7.4/cfg system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set www_dir /usr/local/share/pear@7.4/htdocs system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set test_dir /usr/local/share/pear@7.4/test system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear config-set php_bin /usr/local/opt/php@7.4/bin/php system
==> /usr/local/Cellar/php@7.4/7.4.14/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
(在Apache中启用PHP,需要将以下模块添加到httpd.conf文件中)
LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
(最后检查启动页项目中是否包含index.php)
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
(PHP配置文件php.ini和php-fpm.ini在以下文件夹中)
/usr/local/etc/php/7.4/
php@7.4 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
(一句话没有创建symlink)
If you need to have php@7.4 first in your PATH run:
(在服务中启用,需要添加到环境变量)
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
For compilers to find php@7.4 you may need to set:
(以下语句可以让编译器找到PHP:)
export LDFLAGS="-L/usr/local/opt/php@7.4/lib"
export CPPFLAGS="-I/usr/local/opt/php@7.4/include"
To have launchd start php@7.4 now and restart at login:
(想要开机启动就用这个命令:)
brew services start php@7.4
Or, if you don’t want/need a background service you can just run:
php-fpm
==> Summary
🍺 /usr/local/Cellar/php@7.4/7.4.14: 497 files, 72.3MB
==> Caveats
==> apr
apr is keg-only, which means it was not symlinked into /usr/local,
because Apple’s CLT provides apr.
If you need to have apr first in your PATH run:
echo ‘export PATH=”/usr/local/opt/apr/bin:$PATH”‘ >> ~/.zshrc
==> apr-util
apr-util is keg-only, which means it was not symlinked into /usr/local,
because Apple’s CLT provides apr (but not apr-util).
If you need to have apr-util first in your PATH run:
echo ‘export PATH=”/usr/local/opt/apr-util/bin:$PATH”‘ >> ~/.zshrc
==> openldap
openldap is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have openldap first in your PATH run:
echo ‘export PATH=”/usr/local/opt/openldap/bin:$PATH”‘ >> ~/.zshrc
echo ‘export PATH=”/usr/local/opt/openldap/sbin:$PATH”‘ >> ~/.zshrc
For compilers to find openldap you may need to set:
export LDFLAGS=”-L/usr/local/opt/openldap/lib”
export CPPFLAGS=”-I/usr/local/opt/openldap/include”
==> curl
curl is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have curl first in your PATH run:
echo ‘export PATH=”/usr/local/opt/curl/bin:$PATH”‘ >> ~/.zshrc
For compilers to find curl you may need to set:
export LDFLAGS=”-L/usr/local/opt/curl/lib”
export CPPFLAGS=”-I/usr/local/opt/curl/include”
For pkg-config to find curl you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/curl/lib/pkgconfig”
zsh completions have been installed to:
/usr/local/opt/curl/share/zsh/site-functions
==> libtool
In order to prevent conflicts with Apple’s own libtool we have prepended a “g”
so, you have instead: glibtool and glibtoolize.
==> libffi
libffi is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
For compilers to find libffi you may need to set:
export LDFLAGS=”-L/usr/local/opt/libffi/lib”
export CPPFLAGS=”-I/usr/local/opt/libffi/include”
For pkg-config to find libffi you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/libffi/lib/pkgconfig”
==> readline
readline is keg-only, which means it was not symlinked into /usr/local,
because macOS provides BSD libedit.
For compilers to find readline you may need to set:
export LDFLAGS=”-L/usr/local/opt/readline/lib”
export CPPFLAGS=”-I/usr/local/opt/readline/include”
For pkg-config to find readline you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/readline/lib/pkgconfig”
==> sqlite
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have sqlite first in your PATH run:
echo ‘export PATH=”/usr/local/opt/sqlite/bin:$PATH”‘ >> ~/.zshrc
For compilers to find sqlite you may need to set:
export LDFLAGS=”-L/usr/local/opt/sqlite/lib”
export CPPFLAGS=”-I/usr/local/opt/sqlite/include”
For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/sqlite/lib/pkgconfig”
==> tcl-tk
tcl-tk is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have tcl-tk first in your PATH run:
echo ‘export PATH=”/usr/local/opt/tcl-tk/bin:$PATH”‘ >> ~/.zshrc
For compilers to find tcl-tk you may need to set:
export LDFLAGS=”-L/usr/local/opt/tcl-tk/lib”
export CPPFLAGS=”-I/usr/local/opt/tcl-tk/include”
For pkg-config to find tcl-tk you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/tcl-tk/lib/pkgconfig”
==> python@3.9
Python has been installed as
/usr/local/bin/python3
Unversioned symlinks python
, python-config
, pip
etc. pointing topython3
, python3-config
, pip3
etc., respectively, have been installed into
/usr/local/opt/python@3.9/libexec/bin
You can install Python packages with
pip3 install
They will install into the site-package directory
/usr/local/lib/python3.9/site-packages
See: https://docs.brew.sh/Homebrew-and-Python
==> icu4c
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH run:
echo ‘export PATH=”/usr/local/opt/icu4c/bin:$PATH”‘ >> ~/.zshrc
echo ‘export PATH=”/usr/local/opt/icu4c/sbin:$PATH”‘ >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS=”-L/usr/local/opt/icu4c/lib”
export CPPFLAGS=”-I/usr/local/opt/icu4c/include”
For pkg-config to find icu4c you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/icu4c/lib/pkgconfig”
==> krb5
krb5 is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
If you need to have krb5 first in your PATH run:
echo ‘export PATH=”/usr/local/opt/krb5/bin:$PATH”‘ >> ~/.zshrc
echo ‘export PATH=”/usr/local/opt/krb5/sbin:$PATH”‘ >> ~/.zshrc
For compilers to find krb5 you may need to set:
export LDFLAGS=”-L/usr/local/opt/krb5/lib”
export CPPFLAGS=”-I/usr/local/opt/krb5/include”
For pkg-config to find krb5 you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/krb5/lib/pkgconfig”
==> libpq
libpq is keg-only, which means it was not symlinked into /usr/local,
because conflicts with postgres formula.
If you need to have libpq first in your PATH run:
echo ‘export PATH=”/usr/local/opt/libpq/bin:$PATH”‘ >> ~/.zshrc
For compilers to find libpq you may need to set:
export LDFLAGS=”-L/usr/local/opt/libpq/lib”
export CPPFLAGS=”-I/usr/local/opt/libpq/include”
For pkg-config to find libpq you may need to set:
export PKG_CONFIG_PATH=”/usr/local/opt/libpq/lib/pkgconfig”
==> php@7.4
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@7.4/lib/httpd/modules/libphp7.so
<FilesMatch \.php$><br /> SetHandler application/x-httpd-php<br /> </FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.4/
php@7.4 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.4 first in your PATH run:
echo ‘export PATH=”/usr/local/opt/php@7.4/bin:$PATH”‘ >> ~/.zshrc
echo ‘export PATH=”/usr/local/opt/php@7.4/sbin:$PATH”‘ >> ~/.zshrc
For compilers to find php@7.4 you may need to set:
export LDFLAGS=”-L/usr/local/opt/php@7.4/lib”
export CPPFLAGS=”-I/usr/local/opt/php@7.4/include”
To have launchd start php@7.4 now and restart at login:
brew services start php@7.4
Or, if you don’t want/need a background service you can just run:
php-fpm
以上语句自己翻译吧,翻译累了。而且多有重复。
2.2需要执行的配置命令
一步到位就按照以下的方式补写就行了
写完了记得source .zshrc