phpfmt_stable
phpfmt_stable copied to clipboard
Why doesn't it work?
Hi. I've followed the installation instructions. I'm using Sublime Text 3 with phpfmt and php 7.03 installed on Win 8.1. My php.exe file is in this folder: D:\xampp\php
When I press CTRL F11, my code does not change.
My phpfmt.sublime-settings file is { "version": 4, "php_bin":"D:\xampp\php", // "format_on_save":true, "option": "value" }
I've also tried "php_bin":"D:\xampp\php",
but ST complains about invalid escapes.
I've also tried "php_bin":"D:/xampp/php",
which is not windows syntax, but anyway, that doesn't work.
I reboot after each change, but no luck.
What am I doing wrong?
Note that this does format my code: CTRL Shift r because this is in my Sublime Keymap { "keys": ["ctrl+shift+r"], "command": "reindent" , "args": { "single_line": false } }
For field "php_bin" enter the path to the php.exe Example: "php_bin":"c:/PHP/php.exe"
i have the same question,and my php path includes .exe
As you can see in my original post, my actual php.exe file is in this folder: D:\xampp\php
My code has this in the 2nd line: "php_bin":"D:\xampp\php",
That seems correct, as per your instructions. But since it does not work, please tell me exactly what I should write in the 2nd line.
Thanks.
You should use: "php_bin":"D:\xampp\php\php.exe"
Thanks for the suggestion r15ch13. However, that gives me the following error: "Error trying to parse setting: Invalid escape"
Doubling the back slashes also doesn't work. (D:\xampp\php\php.exe)
And by the way, my windows environment path contains this: D:\xampp\php\php.exe;
Mine looks like this: "php_bin": "D:/wamp64/bin/php/php7.0.0/php.exe",
I've verified that my path is correct, but the plugin still doesn't work. I think I'll just give up, and continue using Sublime Text 3's built-in formatting, which mostly works. Thanks.
try to fix your config by comparing with mine,
{
"autocomplete": true,
"autoimport": true,
"enable_auto_align": true,
"engine": "fmt.phar",
"format_on_save": true,
"indent_with_space": 4,
"options":
[
"fix",
"-n"
],
"passes":
[
"AlignPHPCode",
"AlignTypehint",
"ShortArray"
],
"php_bin": "C:/Ampps/php-7.0/php.exe",
"psr1": true,
"psr2": true,
"version": 1
}
Also the same issue
I just had a file that refused to format until I changed the first line. When the opening tag was <?
, the file didn't change. But when I changed it to <?php
, suddenly the formatter worked. This behavior could be what's causing this issue.
Update - SOLVED (for me at least) I restarted sublimetext, had error appear when formatting about vc redist, so installed latest of that and now it works, just version and php_bin in config right now.
Old issue (now solved)
same issue, similar situation and php version, tried that config and no diff.
Here is the console log
Traceback (most recent call last):
File "C:\Program Files\Sublime Text 3\sublime_plugin.py", line 818, in run_
return self.run(edit)
File "C:\Users\training6\AppData\Roaming\Sublime Text 3\Packages\phpfmt\phpfmt.py", line 674, in run
src = dofmt(self, self.view, None, src, True)
File "C:\Users\training6\AppData\Roaming\Sublime Text 3\Packages\phpfmt\phpfmt.py", line 155, in dofmt
p.stdin.write(src.encode('utf-8'))
BrokenPipeError: [Errno 32] Broken pipe
@dabros I hvar same error like you. And my sublime is current edition. Can you tell me ,how do you solved
@dabros like this
@hangjian8023 - hope you sorted it, working mostly with visual studio atm, but iirc then nothing more to share than what i posted above :)