brew install php@7.4
<br/>安装期间会有此类错误,手动安装即可 brew install webp<br/>
Error: No such file or directory @ rb_sysopen - /Users/--webp-1.2.2.arm64_monterey.bottle.tar.gz
安装成功后
==> Installing php@7.4
==> Pouring php@7.4-7.4.30.arm64_monterey.bottle.tar.gz
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set php_ini /opt/homebrew/etc/php/7.4/php.ini system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set php_dir /opt/homebrew/share/pear@7.4 system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set doc_dir /opt/homebrew/share/pear@7.4/doc system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set ext_dir /opt/homebrew/lib/php/pecl/20190902 system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set bin_dir /opt/homebrew/opt/php@7.4/bin system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set data_dir /opt/homebrew/share/pear@7.4/data system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set cfg_dir /opt/homebrew/share/pear@7.4/cfg system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set www_dir /opt/homebrew/share/pear@7.4/htdocs system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set man_dir /opt/homebrew/share/man system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set test_dir /opt/homebrew/share/pear@7.4/test system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear config-set php_bin /opt/homebrew/opt/php@7.4/bin/php system
==> /opt/homebrew/Cellar/php@7.4/7.4.30/bin/pear update-channels
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /opt/homebrew/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:
/opt/homebrew/etc/php/7.4/
php@7.4 is keg-only, which means it was not symlinked into /opt/homebrew,
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="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
For compilers to find php@7.4 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"
export CPPFLAGS="-I/opt/homebrew/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:
/opt/homebrew/opt/php@7.4/sbin/php-fpm --nodaemonize
==> Summary
🍺 /opt/homebrew/Cellar/php@7.4/7.4.30: 498 files, 72.8MB
==> 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`).
==> Caveats
==> php@7.4
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /opt/homebrew/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:
/opt/homebrew/etc/php/7.4/
php@7.4 is keg-only, which means it was not symlinked into /opt/homebrew,
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="/opt/homebrew/opt/php@7.4/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
For compilers to find php@7.4 you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/php@7.4/lib"
export CPPFLAGS="-I/opt/homebrew/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:
/opt/homebrew/opt/php@7.4/sbin/php-fpm --nodaemonize