安装php7.4
(base) actor ~ $brew install php@7.4
Warning: php@7.4 has been deprecated because it is a versioned formula!
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/ca-certificates-2022-02-01.all.bottle.tar
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openssl%401.1-1.1.1m.monterey.bottle.tar.
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/argon2-20190702_1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/aspell-0.60.8.monterey.bottle.1.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/m4-1.4.19.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/autoconf-2.71.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/brotli-1.0.9.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libunistring-1.0.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libnghttp2-1.46.0.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libssh2-1.10.0.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/openldap-2.6.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/rtmpdump-2.4%2B20151223_1.monterey.bottle
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/zstd-1.5.2.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/curl-7.81.0.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libtool-2.4.6_4.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/unixodbc-2.3.9_1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/freetds-1.3.7.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libpng-1.6.37.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/freetype-2.11.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/fontconfig-2.13.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/jpeg-9e.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libtiff-4.3.0.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/giflib-5.2.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/webp-1.2.2.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gd-2.3.3_1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/gmp-6.2.1_1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/icu4c-69.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/krb5-1.19.2.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libpq-14.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libsodium-1.0.18_1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/libzip-1.8.0_1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/oniguruma-6.9.7.1.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/readline-8.1.2.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/sqlite-3.37.2.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/tidy-html5-5.8.0.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/php%407.4-7.4.27.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for php@7.4: ca-certificates, openssl@1.1, argon2, aspell, m4, autoconf, brotli, libunistring, libnghttp2, libssh2, openldap, rtmpdump, zstd, curl, libtool, unixodbc, freetds, libpng, freetype, fontconfig, jpeg, libtiff, giflib, webp, gd, gmp, icu4c, krb5, libpq, libsodium, libzip, oniguruma, readline, sqlite and tidy-html5
==> Installing php@7.4 dependency: ca-certificates
==> Pouring ca-certificates-2022-02-01.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺 /usr/local/Cellar/ca-certificates/2022-02-01: 3 files, 213.3KB
==> Installing php@7.4 dependency: openssl@1.1
==> Pouring openssl@1.1-1.1.1m.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/openssl@1.1/1.1.1m: 8,081 files, 18.5MB
==> Installing php@7.4 dependency: argon2
==> Pouring argon2-20190702_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/argon2/20190702_1: 12 files, 667.6KB
==> Installing php@7.4 dependency: aspell
==> Pouring aspell-0.60.8.monterey.bottle.1.tar.gz
🍺 /usr/local/Cellar/aspell/0.60.8: 767 files, 322.6MB
==> Installing php@7.4 dependency: m4
==> Pouring m4-1.4.19.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/m4/1.4.19: 13 files, 740.7KB
==> Installing php@7.4 dependency: autoconf
==> Pouring autoconf-2.71.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/autoconf/2.71: 71 files, 3.2MB
==> Installing php@7.4 dependency: brotli
==> Pouring brotli-1.0.9.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/brotli/1.0.9: 25 files, 2.3MB
==> Installing php@7.4 dependency: libunistring
==> Pouring libunistring-1.0.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libunistring/1.0: 56 files, 5MB
==> Installing php@7.4 dependency: libnghttp2
==> Pouring libnghttp2-1.46.0.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libnghttp2/1.46.0: 13 files, 673.2KB
==> Installing php@7.4 dependency: libssh2
==> Pouring libssh2-1.10.0.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libssh2/1.10.0: 184 files, 999.7KB
==> Installing php@7.4 dependency: openldap
==> Pouring openldap-2.6.1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/openldap/2.6.1: 340 files, 7.6MB
==> Installing php@7.4 dependency: rtmpdump
==> Pouring rtmpdump-2.4+20151223_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/rtmpdump/2.4+20151223_1: 20 files, 603.7KB
==> Installing php@7.4 dependency: zstd
==> Pouring zstd-1.5.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/zstd/1.5.2: 31 files, 2.7MB
==> Installing php@7.4 dependency: curl
==> Pouring curl-7.81.0.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/curl/7.81.0: 497 files, 4.0MB
==> Installing php@7.4 dependency: libtool
==> Pouring libtool-2.4.6_4.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libtool/2.4.6_4: 75 files, 3.7MB
==> Installing php@7.4 dependency: unixodbc
==> Pouring unixodbc-2.3.9_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/unixodbc/2.3.9_1: 46 files, 2.1MB
==> Installing php@7.4 dependency: freetds
==> Pouring freetds-1.3.7.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/freetds/1.3.7: 1,262 files, 13.8MB
==> Installing php@7.4 dependency: libpng
==> Pouring libpng-1.6.37.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libpng/1.6.37: 27 files, 1.3MB
==> Installing php@7.4 dependency: freetype
==> Pouring freetype-2.11.1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/freetype/2.11.1: 66 files, 2.3MB
==> Installing php@7.4 dependency: fontconfig
==> Pouring fontconfig-2.13.1.monterey.bottle.tar.gz
==> Regenerating font cache, this may take a while
==> /usr/local/Cellar/fontconfig/2.13.1/bin/fc-cache -frv
🍺 /usr/local/Cellar/fontconfig/2.13.1: 530 files, 3.6MB
==> Installing php@7.4 dependency: jpeg
==> Pouring jpeg-9e.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/jpeg/9e: 21 files, 939.3KB
==> Installing php@7.4 dependency: libtiff
==> Pouring libtiff-4.3.0.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libtiff/4.3.0: 249 files, 4.4MB
==> Installing php@7.4 dependency: giflib
==> Pouring giflib-5.2.1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/giflib/5.2.1: 19 files, 583.6KB
==> Installing php@7.4 dependency: webp
==> Pouring webp-1.2.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/webp/1.2.2: 41 files, 2.5MB
==> Installing php@7.4 dependency: gd
==> Pouring gd-2.3.3_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/gd/2.3.3_1: 33 files, 1.4MB
==> Installing php@7.4 dependency: gmp
==> Pouring gmp-6.2.1_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/gmp/6.2.1_1: 21 files, 3.3MB
==> Installing php@7.4 dependency: icu4c
==> Pouring icu4c-69.1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/icu4c/69.1: 259 files, 72.7MB
==> Installing php@7.4 dependency: krb5
==> Pouring krb5-1.19.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/krb5/1.19.2: 162 files, 5.1MB
==> Installing php@7.4 dependency: libpq
==> Pouring libpq-14.1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libpq/14.1: 2,335 files, 27.8MB
==> Installing php@7.4 dependency: libsodium
==> Pouring libsodium-1.0.18_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libsodium/1.0.18_1: 73 files, 1MB
==> Installing php@7.4 dependency: libzip
==> Pouring libzip-1.8.0_1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/libzip/1.8.0_1: 144 files, 772.2KB
==> Installing php@7.4 dependency: oniguruma
==> Pouring oniguruma-6.9.7.1.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/oniguruma/6.9.7.1: 14 files, 1.4MB
==> Installing php@7.4 dependency: readline
==> Pouring readline-8.1.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/readline/8.1.2: 48 files, 1.6MB
==> Installing php@7.4 dependency: sqlite
==> Pouring sqlite-3.37.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/sqlite/3.37.2: 11 files, 4.3MB
==> Installing php@7.4 dependency: tidy-html5
==> Pouring tidy-html5-5.8.0.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/tidy-html5/5.8.0: 14 files, 2.9MB
==> Installing php@7.4
==> Pouring php@7.4-7.4.27.monterey.bottle.tar.gz
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set php_ini /usr/local/etc/php/7.4/php.ini system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set php_dir /usr/local/share/pear@7.4 system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set doc_dir /usr/local/share/pear@7.4/doc system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20190902 system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set bin_dir /usr/local/opt/php@7.4/bin system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set data_dir /usr/local/share/pear@7.4/data system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set cfg_dir /usr/local/share/pear@7.4/cfg system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set www_dir /usr/local/share/pear@7.4/htdocs system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set test_dir /usr/local/share/pear@7.4/test system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear config-set php_bin /usr/local/opt/php@7.4/bin/php system
==> /usr/local/Cellar/php@7.4/7.4.27/bin/pear update-channels
==> Caveats
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$>
SetHandler application/x-httpd-php
</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 restart php@7.4 after an upgrade:
brew services restart php@7.4
Or, if you don't want/need a background service you can just run:
/usr/local/opt/php@7.4/sbin/php-fpm --nodaemonize
==> Summary
🍺 /usr/local/Cellar/php@7.4/7.4.27: 498 files, 72.3MB
==> Running `brew cleanup php@7.4`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Upgrading 1 dependent:
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
wget 1.21.1 -> 1.21.2
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/wget-1.21.2.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Upgrading wget
1.21.1 -> 1.21.2
==> Pouring wget-1.21.2.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/wget/1.21.2: 89 files, 4.2MB
==> Running `brew cleanup wget`...
Removing: /usr/local/Cellar/wget/1.21.1... (88 files, 4MB)
Removing: /Users/actor/Library/Caches/Homebrew/wget--1.21.1... (1.4MB)
==> Checking for dependents of upgraded formulae...
==> Reinstalling 1 dependent with broken linkage from source:
php@7.4
Warning: php@7.4 has been deprecated because it is a versioned formula!
==> Caveats
==> 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$>
SetHandler application/x-httpd-php
</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.
To restart php@7.4 after an upgrade:
brew services restart php@7.4
Or, if you don't want/need a background service you can just run:
/usr/local/opt/php@7.4/sbin/php-fpm --nodaemonize
(base) actor ~ $
(base) actor ~ $brew services start php@7.4
Error: Formula `php@7.4` has not implemented #plist or installed a locatable .plist file
# 解决上述错误,如下:
(base) actor ~ $brew link --force php@7.4
Linking /usr/local/Cellar/php@7.4/7.4.27.reinstall... 25 symlinks created.
If you need to have this software first in your PATH instead consider running:
echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
(base) actor ~ $echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
(base) actor ~ $echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
(base) actor ~ $brew services start php@7.4
==> Successfully started `php@7.4` (label: homebrew.mxcl.php@7.4)
安装nginx1.21
(base) actor ~ $brew install nginx
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/pcre-8.45.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/bottles/nginx-1.21.6.monterey.bottle.tar.gz
######################################################################## 100.0%
==> Installing dependencies for nginx: pcre
==> Installing nginx dependency: pcre
==> Pouring pcre-8.45.monterey.bottle.tar.gz
🍺 /usr/local/Cellar/pcre/8.45: 204 files, 5.7MB
==> Installing nginx
==> Pouring nginx-1.21.6.monterey.bottle.tar.gz
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To restart nginx after an upgrade:
brew services restart nginx
Or, if you don't want/need a background service you can just run:
/usr/local/opt/nginx/bin/nginx -g daemon off;
==> Summary
🍺 /usr/local/Cellar/nginx/1.21.6: 26 files, 2.2MB
==> Running `brew cleanup nginx`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Caveats
==> nginx
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To restart nginx after an upgrade:
brew services restart nginx
Or, if you don't want/need a background service you can just run:
/usr/local/opt/nginx/bin/nginx -g daemon off;
(base) actor ~ $
参考:
https://blog.csdn.net/weixin_41827162/article/details/119213381
https://stackoverflow.com/questions/59142504/switch-of-php-versions-not-working-on-mac/59150210#59150210