Skip to content

WinError 193. (Run on Windows without Composer?) #204

@rusproject

Description

@rusproject

Hello! Can't get it work on windows, getting WinError 193 or WinError 2.

Phpcs itself working perfectly when I run it from command prompt (C:\php\php.exe C:\php\php-cs-fixer-v3.phar fix D:\project2\model\_Criteria.php --verbose)

but not from ST4 plugin. I've tried to specify "phpcs_php_prefix_path": "C:\\php\\php.exe", or "phpcs_php_prefix_path": "C:/php/php.exe", but it doesn't work, keep getting an error


[Phpcs] Project files:
[Phpcs]  Current: None
[Phpcs]  Last Known: None
[Phpcs] No project file defined, therefore skipping reload
[Phpcs] C:\php\php-cs-fixer.phar fix D:\project\code\model\_Criteria.php --verbose
[Phpcs] C:\php\php-cs-fixer.phar fix D:\project\code\model\_Criteria.php --verbose
[Phpcs] cwd: C:\Users\alex
Traceback (most recent call last):
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 904, in on_post_save
    run_view_callbacks('on_post_save', view_id)
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 708, in run_view_callbacks
    callback(v, *args)
  File "C:\Program Files\Sublime Text 3\Lib\python33\sublime_plugin.py", line 152, in profiler
    return event_handler(*args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 788, in on_post_save
    cmd.fix_standards_errors("Fixer", view.file_name())
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 560, in fix_standards_errors
    fixes = Fixer().get_errors(path)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 149, in get_errors
    self.execute(path)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 286, in execute
    self.parse_report(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 289, in parse_report
    report = self.shell_out(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 176, in shell_out
    proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=info, cwd=self.workingDir)
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1110, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
[Phpcs] C:\php\phpcs.phar --report=checkstyle --standard=PSR2 -n D:\project\code\model\_Criteria.php
[Phpcs] C:\php\phpcs.phar --report=checkstyle --standard=PSR2 -n D:\project\code\model\_Criteria.php
[Phpcs] cwd: D:\project\code\model
Exception in thread Thread-2858:
Traceback (most recent call last):
  File "./python3.3/subprocess.py", line 1104, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./python3.3/threading.py", line 901, in _bootstrap_inner
  File "./python3.3/threading.py", line 858, in run
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 488, in run
    self.checkstyle_reports.append(['Sniffer', Sniffer().get_errors(path), 'dot'])
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 149, in get_errors
    self.execute(path)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 231, in execute
    self.parse_report(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 234, in parse_report
    report = self.shell_out(args)
  File "C:\Users\alex\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 176, in shell_out
    proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, startupinfo=info, cwd=self.workingDir)
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1110, in _execute_child
OSError: [WinError 193] %1 is not a valid Win32 application

SublimeLinter: WARNING: phpcs cannot locate 'phpcs'
Please refer to the readme of this plugin and our troubleshooting guide: http://www.sublimelinter.com/en/stable/troubleshooting.html

Are there some instructions or examples for installing and/or configuring phpcs for sublime text 4 on windows (without using composer for phpcs installation)?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions