macOS12安装php7.4+nginx1.21

安装php7.4

(base) actor ~ $brew install [email protected]
Warning: [email protected] 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 [email protected]: ca-certificates, [email protected], 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 [email protected] 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 [email protected] dependency: [email protected]
==> Pouring [email protected]
  /usr/local/Cellar/[email protected]/1.1.1m: 8,081 files, 18.5MB
==> Installing [email protected] dependency: argon2
==> Pouring argon2-20190702_1.monterey.bottle.tar.gz
  /usr/local/Cellar/argon2/20190702_1: 12 files, 667.6KB
==> Installing [email protected] dependency: aspell
==> Pouring aspell-0.60.8.monterey.bottle.1.tar.gz
  /usr/local/Cellar/aspell/0.60.8: 767 files, 322.6MB
==> Installing [email protected] dependency: m4
==> Pouring m4-1.4.19.monterey.bottle.tar.gz
  /usr/local/Cellar/m4/1.4.19: 13 files, 740.7KB
==> Installing [email protected] dependency: autoconf
==> Pouring autoconf-2.71.monterey.bottle.tar.gz
  /usr/local/Cellar/autoconf/2.71: 71 files, 3.2MB
==> Installing [email protected] dependency: brotli
==> Pouring brotli-1.0.9.monterey.bottle.tar.gz
  /usr/local/Cellar/brotli/1.0.9: 25 files, 2.3MB
==> Installing [email protected] dependency: libunistring
==> Pouring libunistring-1.0.monterey.bottle.tar.gz
  /usr/local/Cellar/libunistring/1.0: 56 files, 5MB
==> Installing [email protected] dependency: libnghttp2
==> Pouring libnghttp2-1.46.0.monterey.bottle.tar.gz
  /usr/local/Cellar/libnghttp2/1.46.0: 13 files, 673.2KB
==> Installing [email protected] dependency: libssh2
==> Pouring libssh2-1.10.0.monterey.bottle.tar.gz
  /usr/local/Cellar/libssh2/1.10.0: 184 files, 999.7KB
==> Installing [email protected] dependency: openldap
==> Pouring openldap-2.6.1.monterey.bottle.tar.gz
  /usr/local/Cellar/openldap/2.6.1: 340 files, 7.6MB
==> Installing [email protected] 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 [email protected] dependency: zstd
==> Pouring zstd-1.5.2.monterey.bottle.tar.gz
  /usr/local/Cellar/zstd/1.5.2: 31 files, 2.7MB
==> Installing [email protected] dependency: curl
==> Pouring curl-7.81.0.monterey.bottle.tar.gz
  /usr/local/Cellar/curl/7.81.0: 497 files, 4.0MB
==> Installing [email protected] 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 [email protected] 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 [email protected] dependency: freetds
==> Pouring freetds-1.3.7.monterey.bottle.tar.gz
  /usr/local/Cellar/freetds/1.3.7: 1,262 files, 13.8MB
==> Installing [email protected] dependency: libpng
==> Pouring libpng-1.6.37.monterey.bottle.tar.gz
  /usr/local/Cellar/libpng/1.6.37: 27 files, 1.3MB
==> Installing [email protected] dependency: freetype
==> Pouring freetype-2.11.1.monterey.bottle.tar.gz
  /usr/local/Cellar/freetype/2.11.1: 66 files, 2.3MB
==> Installing [email protected] 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 [email protected] dependency: jpeg
==> Pouring jpeg-9e.monterey.bottle.tar.gz
  /usr/local/Cellar/jpeg/9e: 21 files, 939.3KB
==> Installing [email protected] dependency: libtiff
==> Pouring libtiff-4.3.0.monterey.bottle.tar.gz
  /usr/local/Cellar/libtiff/4.3.0: 249 files, 4.4MB
==> Installing [email protected] dependency: giflib
==> Pouring giflib-5.2.1.monterey.bottle.tar.gz
  /usr/local/Cellar/giflib/5.2.1: 19 files, 583.6KB
==> Installing [email protected] dependency: webp
==> Pouring webp-1.2.2.monterey.bottle.tar.gz
  /usr/local/Cellar/webp/1.2.2: 41 files, 2.5MB
==> Installing [email protected] 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 [email protected] 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 [email protected] dependency: icu4c
==> Pouring icu4c-69.1.monterey.bottle.tar.gz
  /usr/local/Cellar/icu4c/69.1: 259 files, 72.7MB
==> Installing [email protected] dependency: krb5
==> Pouring krb5-1.19.2.monterey.bottle.tar.gz
  /usr/local/Cellar/krb5/1.19.2: 162 files, 5.1MB
==> Installing [email protected] dependency: libpq
==> Pouring libpq-14.1.monterey.bottle.tar.gz
  /usr/local/Cellar/libpq/14.1: 2,335 files, 27.8MB
==> Installing [email protected] dependency: libsodium
==> Pouring libsodium-1.0.18_1.monterey.bottle.tar.gz
  /usr/local/Cellar/libsodium/1.0.18_1: 73 files, 1MB
==> Installing [email protected] 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 [email protected] 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 [email protected] dependency: readline
==> Pouring readline-8.1.2.monterey.bottle.tar.gz
  /usr/local/Cellar/readline/8.1.2: 48 files, 1.6MB
==> Installing [email protected] dependency: sqlite
==> Pouring sqlite-3.37.2.monterey.bottle.tar.gz
  /usr/local/Cellar/sqlite/3.37.2: 11 files, 4.3MB
==> Installing [email protected] 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 [email protected]
==> Pouring [email protected]
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set php_ini /usr/local/etc/php/7.4/php.ini system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set php_dir /usr/local/share/[email protected] system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set doc_dir /usr/local/share/[email protected]/doc system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set ext_dir /usr/local/lib/php/pecl/20190902 system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set bin_dir /usr/local/opt/[email protected]/bin system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set data_dir /usr/local/share/[email protected]/data system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set cfg_dir /usr/local/share/[email protected]/cfg system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set www_dir /usr/local/share/[email protected]/htdocs system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set man_dir /usr/local/share/man system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set test_dir /usr/local/share/[email protected]/test system
==> /usr/local/Cellar/[email protected]/7.4.27/bin/pear config-set php_bin /usr/local/opt/[email protected]/bin/php system
==> /usr/local/Cellar/[email protected]/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/[email protected]/lib/httpd/modules/libphp7.so

    
        SetHandler application/x-httpd-php
    

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/

[email protected] 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 [email protected] first in your PATH, run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"


To restart [email protected] after an upgrade:
  brew services restart [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/sbin/php-fpm --nodaemonize
==> Summary
  /usr/local/Cellar/[email protected]/7.4.27: 498 files, 72.3MB
==> Running `brew cleanup [email protected]`...
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:
[email protected]
Warning: [email protected] has been deprecated because it is a versioned formula!
==> Caveats
==> [email protected]
To enable PHP in Apache add the following to httpd.conf and restart Apache:
    LoadModule php7_module /usr/local/opt/[email protected]/lib/httpd/modules/libphp7.so

    
        SetHandler application/x-httpd-php
    

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/

[email protected] is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.


To restart [email protected] after an upgrade:
  brew services restart [email protected]
Or, if you don't want/need a background service you can just run:
  /usr/local/opt/[email protected]/sbin/php-fpm --nodaemonize
(base) actor ~ $
(base) actor ~ $brew services start [email protected]
Error: Formula `[email protected]` has not implemented #plist or installed a locatable .plist file
# 解决上述错误,如下:
(base) actor ~ $brew link --force [email protected]
Linking /usr/local/Cellar/[email protected]/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/[email protected]/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
(base) actor ~ $echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
(base) actor ~ $echo 'export PATH="/usr/local/opt/[email protected]/sbin:$PATH"' >> ~/.zshrc
(base) actor ~ $brew services start [email protected]
==> Successfully started `[email protected]` (label: [email protected])

安装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

你可能感兴趣的:(macOS12安装php7.4+nginx1.21)