phpfmt_stable icon indicating copy to clipboard operation
phpfmt_stable copied to clipboard

Why doesn't it work?

Open ThinkALot opened this issue 7 years ago • 14 comments

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 } }

ThinkALot avatar Jul 16 '16 23:07 ThinkALot

For field "php_bin" enter the path to the php.exe Example: "php_bin":"c:/PHP/php.exe"

wilon avatar Jul 18 '16 02:07 wilon

i have the same question,and my php path includes .exe

xiejc avatar Jul 18 '16 13:07 xiejc

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.

ThinkALot avatar Jul 18 '16 13:07 ThinkALot

You should use: "php_bin":"D:\xampp\php\php.exe"

r15ch13 avatar Jul 27 '16 11:07 r15ch13

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;

ThinkALot avatar Jul 27 '16 15:07 ThinkALot

Mine looks like this: "php_bin": "D:/wamp64/bin/php/php7.0.0/php.exe",

r15ch13 avatar Jul 27 '16 17:07 r15ch13

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.

ThinkALot avatar Jul 27 '16 19:07 ThinkALot

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
}

ghost avatar Sep 27 '16 22:09 ghost

Also the same issue

hao203 avatar Mar 28 '17 12:03 hao203

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.

tylermumford avatar May 05 '17 21:05 tylermumford

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 avatar May 26 '17 02:05 dabros

@dabros I hvar same error like you. And my sublime is current edition. Can you tell me ,how do you solved

hangjian8023 avatar Nov 25 '17 17:11 hangjian8023

@dabros like this image

hangjian8023 avatar Nov 25 '17 17:11 hangjian8023

@hangjian8023 - hope you sorted it, working mostly with visual studio atm, but iirc then nothing more to share than what i posted above :)

dabros avatar Mar 22 '18 04:03 dabros