Bash: php command not found

Questions : bash: php: command not found in VSC only

2022-09-26T05:48:34+00:00 2022-09-26T05:48:34+00:00

625

php -v works in individual terminals, but do anycodings_bash not work in Visual Studio Code Terminal.

I tried php -v in Git Bash and Command anycodings_bash Prompt in Windows, and all worked.

So I tried in VSC where I set default shell anycodings_bash to Git Bash, but it shows error with bash: anycodings_bash php: command not found (I added php bin path anycodings_bash to Path)

Terminal at VSC do not get PATH variable?

Total Answers 1

25

Answers 1 : of bash: php: command not found in VSC only

I got the same problem... My problem was anycodings_visual-studio-code in VSC FlatPack version available in the anycodings_visual-studio-code Software Manager in Mint 18.3. I anycodings_visual-studio-code uninstalled it and got the original anycodings_visual-studio-code version on https://code.visualstudio.com anycodings_visual-studio-code See more at: anycodings_visual-studio-code https://github.com/microsoft/vscode/issues/44646

0

2022-09-26T05:48:34+00:00 2022-09-26T05:48:34+00:00Answer Link

mRahman

Skip to content

Bash: php command not found

On MAC if you are running the php command in the terminal and getting the php: command not found then you can try the following steps to solve that:

zshrc

Open the .zshrc file by running the following command:

nano ~/.zshrc

Do the following steps in that file:

  1. Paste the export PATH=”/opt/homebrew/opt//bin:$PATH” line in that end of that file.
  2. Hit CTRL + O
  3. Hit CTRL + Enter Key
  4. Hit CTRL + X
Bash: php command not found

Close the terminal and restart it to test php command now.

bashrc

Open the .bashrc file by running the following command:

nano ~/.bashrc

Do the following steps in that file:

  1. Paste the export PATH=”/opt/homebrew/opt//bin:$PATH” line in that file.
  2. Hit CTRL + O
  3. Hit CTRL + Enter Key
  4. Hit CTRL + X
Bash: php command not found

Close the terminal and restart it to test php command now.

bash_profile

Open the .bash_profile file by running the following command:

nano ~/.bash_profile

Do the following steps in that file:

  1. Paste the export PATH=”/opt/homebrew/opt//bin:$PATH” line in that end of that file.
  2. Hit CTRL + O
  3. Hit CTRL + Enter Key
  4. Hit CTRL + X
Bash: php command not found

Close the terminal and restart it to test php command now.

php command should work now and php-v will give you the following output

php -v

PHP 7.4.29 (cli) (built: Apr 14 2022 11:36:10) ( NTS )