$ brew search php@7 ==> Formulae php@7.4 shivammathur/php/php@7.1-debug shivammathur/php/php@7.3-debug shivammathur/php/php@7.0 shivammathur/php/php@7.2 shivammathur/php/php@7.4 shivammathur/php/php@7.0-debug shivammathur/php/php@7.2-debug shivammathur/php/php@7.4-debug shivammathur/php/php@7.1 shivammathur/php/php@7.3 php ✔
% brew install shivammathur/php/php@7.4 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 shivammathur/php/php@7.4 after an upgrade: brew services restart shivammathur/php/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 To enable PHP in Apache add the following to httpd.conf and restart Apache: LoadModule php_module /usr/local/opt/php/lib/httpd/modules/libphp.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/8.2/ To restart php after an upgrade: brew services restart php Or, if you don't want/need a background service you can just run: /usr/local/opt/php/sbin/php-fpm --nodaemonize
$ echo 'export PATH="/usr/local/opt/php@7.4/bin:$PATH"' >> ~/.zshrc $ echo 'export PATH="/usr/local/opt/php@7.4/sbin:$PATH"' >> ~/.zshrc
一旦ターミナルをログアウトして
kanehiroyuu@MacBook-Pro-3 laravel-clean-architecture % php -v PHP 7.4.33 (cli) (built: Dec 8 2022 21:39:37) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.33, Copyright (c), by Zend Technologies