PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting
VSCode
で以下のようなエラーが出ていた。
PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting
php
入ってるはずなんだけど・・・。と思いつつ php -v
を実行した。
λ php -v
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: Nov 23 2020 06:45:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies
WARNING: PHP is not recommended
というエラーがでている。
λ which php
/usr/bin/php
λ brew install php@7.4
...
λ echo 'set -g fish_user_paths "/usr/local/opt/php@7.4/bin" $fish_user_paths' >> ~/.config/fish/config.fish
λ echo 'set -g fish_user_paths "/usr/local/opt/php@7.4/sbin" $fish_user_paths' >> ~/.config/fish/config.fish
λ set -gx LDFLAGS "-L/usr/local/opt/php@7.4/lib"
λ set -gx CPPFLAGS "-I/usr/local/opt/php@7.4/include"
よしできた。
λ php -v
PHP 7.4.14 (cli) (built: Jan 8 2021 13:20:04) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies