question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

phpcs.executablePath not work on Windows 10

See original GitHub issue

i tryed

"phpcs.executablePath": "C:/Users/user/bin/PHP_CodeSniffer/vendor/bin/phpcs.bat"

and this

"phpcs.executablePath": "C:\\Users\\user\\bin\\PHP_CodeSniffer\\vendor\\bin\\phpcs.bat"

  • from command line - it work
  • from vscode 1.20.1 - not work

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
flykecommented, Jul 30, 2019

For me it was not working with phpcs installed globally via composer. Although not mentionned, the problem lied in the source of my php executable. I use Ampps (like Xamp/Mamp) for localhosting my php sites and I had to change %userprofile%\AppData\Roaming\Composer\vendor\bin\phpcs.bat to the correct php path. Changed it from:

@ECHO OFF setlocal DISABLEDELAYEDEXPANSION SET BIN_TARGET=%~dp0/…/squizlabs/php_codesniffer/bin/phpcs php “%BIN_TARGET%” %*

To:

@ECHO OFF setlocal DISABLEDELAYEDEXPANSION SET BIN_TARGET=%~dp0/…/squizlabs/php_codesniffer/bin/phpcs “C:\Program Files (x86)\Ampps\php-7.1\php” “%BIN_TARGET%” %*

For reference: in VSCode, in the PHP CodeSniffer settings, this is what I have for my Executable Path: C:/Users/MYUSERNAME/AppData/Roaming/Composer/vendor/bin/phpcs.bat

0reactions
xukkucommented, Feb 28, 2018

all works i have problem if php not installed globally i made fixed script https://github.com/rivetweb/PHP_CodeSniffer/blob/bitrix/phpcs.bat and replace vendor/bin/phpcs.bat

Read more comments on GitHub >

github_iconTop Results From Across the Web

Visual Studio Code: Unable to locate phpcs - Stack Overflow
Didn't work on my Windows 10 i had to add phpcs at the end like the following: C:\Users\{user_name}\AppData\Roaming\Composer\vendor\bin\phpcs. – kuroyza. May 6, ...
Read more >
Developers - phpcs.executablePath not work on Windows 10 -
25 February 2018 Posted by whateveruse. i tryed. "phpcs.executablePath": "C:/Users/user/bin/PHP_CodeSniffer/vendor/bin/phpcs.bat". and this. "phpcs.
Read more >
[SOLVED] Unable to locate phpcs. Please add ... - Robert Askam
Restart your Visual Studio Code and you should now not get the error: phpcs: Unable to locate phpcs. Please add phpcs to your...
Read more >
php-cs-fixer.executable path windows Code Example - Code Grepper
executablePathWindows": "phpcs.bat", "php-cs-fixer.onsave": true, //If you want to ... php.validate.executablepath wamp · why css not working with php file.
Read more >
Setting up WordPress Coding Standards in VS Code
It makes your code easier to maintain and read not only for yourself ... Now that we have WPCS and PHPCS in our...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found