Reputation: 6089
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.
Upvotes: 4
Views: 15501
Reputation: 439
"phpfmt.php_bin": "$(which php)"
works for me (using zsh
, my actual path is /opt/homebrew/bin/php
(which is a symbolic link to ../Cellar/php/8.3.3_1/bin/php
at the moment).
Upvotes: 0
Reputation: 1
"phpfmt.php_bin": "C:/xampp/php/php.exe"
Upvotes: 0
Reputation: 1
You have to find dir to file php.exe and then you can fig that easily by this way below: "phpfmt.php_bin": "F:/Xampp/php/php.exe",
F:/Xampp/php/php.exe - my directory
Upvotes: 0
Reputation: 101
Just add below code in setting.json
in VS Code
"phpfmt.php_bin": "C:/xampp/php/php.exe"
in my case the location is in xampp
so just add your php.exe
location.
Upvotes: 10
Reputation: 416
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
Upvotes: 5
Reputation: 64
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!
Upvotes: 4