Title: phpfmt php formatting extension eror: phpfmt: php_bin "php" is invalid
Tags: php;macos;visual-studio-code
Question: Recently I updated my VS code on my macOS. I'm now running vs code version 1.41.1.
Ever since the reinstall, the phpfmt extension is no longer working and giving me the
phpfmt: php_bin "php" is invalid`
pop up every time I save a file.
I tried removing VS code and installing it again. I removed the extension and reinstalled it as well yet I am still getting this error.
Is there any other settings i can clear. I can't find this error anywhere online.

Here is the accepted answer: assuming you have PHP installed:
Edit your vscode settings (JSON view) add this option:
"phpfmt.php_bin": "php"
If you want auto formatting on save:
All Languages:
"editor.formatOnSave": true
Just PHP:
"[php]": { "editor.formatOnSave": true }
you can always check out the plugin page too:
https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
has this bits of info on this + further configuration
happy coding!

Here is another answer: &quot;phpfmt.php_bin&quot;: &quot;C:/xampp/php/php.exe&quot;
open setting.json in VS code
You have to find your php.exe path and paste it after &quot;phpfmt.php_bin&quot;: &quot;php.exe path&quot;

Here is another answer: On Mac Os:
In the vscode settings (JSON view) extend the ^^ above option with the Mac Os PHP path:
"phpfmt.php_bin": "/usr/bin/php"
Cheers

Here is another answer: Just add below code in setting.json in VS Code
&quot;phpfmt.php_bin&quot;: &quot;C:/xampp/php/php.exe&quot;
in my case the location is in xampp so just add your php.exe location.
Comment for this answer: the user is on macOS

Here is another answer: You have to find dir to file php.exe and then you can fig that easily by this way below:
&quot;phpfmt.php_bin&quot;: &quot;F:/Xampp/php/php.exe&quot;,
F:/Xampp/php/php.exe  - my directory
Comment for this answer: As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 5, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:01/02/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<php><macos><visual-studio-code>', 'Title': 'phpfmt php formatting extension eror: phpfmt: php_bin "php" is invalid', 'ViewCount': 10419, 'id': 59569729, 'user_AboutMe': '<p>#!</p>\n', 'user_AccountId': 405828.0, 'user_DisplayName': 'Xitcod13', 'user_Reputation': 5829.0, 'user_Views': 748.0, 'user_id': 774972.0}}