$ php --version WARNING: PHP is not recommended PHP is included in macOS for compatibility with legacy software. Future versions of macOS will not include PHP. PHP 7.3.24-(to be removed in future macOS) (cli) (built: Jun 17 2021 21:41:15) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
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 start php@7.4: brew services start 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
按照提示,执行如下指令启动 php 服务:
1
$ brew services start php
我们还可以调用如下指令查看当前的服务运行情况:
1 2 3 4
$ brew services list Name Status User Plist php stopped php@7.4 stopped
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