kokororin/vscode-phpfmt

how to set php.exe path

ooing opened this issue · 12 comments

ooing commented
how to set php.exe path

Try

"phpfmt.php_bin": "C:\\php\\php.exe"
ooing commented

thank

or like this: "phpfmt.php_bin": "C:/php/php.exe". Thanks for the great work put into this library.

PHP should be in your PATH already, so just "phpfmt.php_bin": "php" will do...

i'm still getting the same error any solutions ?

"php.validate.executablePath": "C://Program Files//php//php.exe",
"phpfmt.php_bin" :"C://Program Files//php//php.exe",

this is how my file looks like

@shamseerahammedm
microsoft/vscode#533

"phpfmt.php_bin" :"C:/Program Files/php/php.exe",
Or "phpfmt.php_bin" :"C:\\Program Files\\php\\php.exe",

maybe your PHP file path should not have any SPACE !!!
"C:/php/php.exe" worked , but "C:/Program Files/php/php.exe" not work
PHP的目录里不能有空格!!!

I'm getting:
phpfmt: php_bin "c:/php/php-7.2.5-Win32-VC15-x64/php.exe" is invalid

This works fine:
"php.validate.executablePath": "c:/php/php-7.2.5-Win32-VC15-x64/php.exe",

But this one does not:
"phpfmt.php_bin": "c:/php/php-7.2.5-Win32-VC15-x64/php.exe"

I already tried "c:/php/php.exe", but same error - maybe I need another php version?

Am i missing the obvious? where is this configuration file which contains the path of phpfmt.php_bin ?

Am i missing the obvious? where is this configuration file which contains the path of phpfmt.php_bin ?

File>Preferences>Settings
from the window that comes when u choose settings, you need to search for "Edit in settings.json" click on that and over there you need to specify your php.exe file path
mine looks like this

{
 "phpfmt.php_bin": "\"C:\\Program Files\\php\\php.exe\"",
}

I'm getting:
phpfmt: php_bin "c:/php/php-7.2.5-Win32-VC15-x64/php.exe" is invalid

This works fine:
"php.validate.executablePath": "c:/php/php-7.2.5-Win32-VC15-x64/php.exe",

But this one does not:
"phpfmt.php_bin": "c:/php/php-7.2.5-Win32-VC15-x64/php.exe"

I already tried "c:/php/php.exe", but same error - maybe I need another php version?

Its because you are using the wrong path format probably, this is what worked for me ( My php.exe file is in the php folder inside program files )

{
 "phpfmt.php_bin": "\"C:\\Program Files\\php\\php.exe\"",
}

I have an error in output

6/5/2019, 7:07:48 PM
--------------------
Command failed: C:/OSPanel/modules/php/PHP-7.2-x64/php.exe -l  C:\Users\serhi\AppData\Local\Temp\temp-nldvkjje.php

When I run the same command in CMD it works. I've tried with \\ slashes too.

I have this also

"terminal.integrated.shell.windows": "C:\\Windows\\System32\\wsl.exe"

But if I change bin to php ro /usr/bin/php it also does not work although works in WSL terminal.

I want to use this formatter very match because of transformations, after PhpStorm I need those because i get used to them. And I do not want to reformat my old code, to make a mess in git.