vscode-php-cs-fixer icon indicating copy to clipboard operation
vscode-php-cs-fixer copied to clipboard

executable path not found

Open MrTucks opened this issue 6 years ago • 9 comments

Hi, after updating php to 5.6.40 and changing the install directory of it this plugin doesn't work anymore (even though new php.exe is in my PATH, same as old version). I always get the error "PHP CS Fixer: executablePath not found, please check your settings. It will set to built-in php-cs-fixer.phar. Try again!" I constantly get that error. Even after restarting my PC and trying again multiple times. php-cs-fixer.phar is in the extension directory. I also tried installing php-cs-fixer.phar to my PATH and changing the php-cs-fixer.executablePath to "php-cs-fixer.phar" but it still gives the same error even though I can type "php-cs-fixer.phar" in any console window anywhere and it works there. I also put php-cs-fixer.phar in my D: drive and my own documents folder and put the whole path to the file in php-cs-fixer.executablePath, still the same error message. I also reinstalled the extension, and uninstalled it, deleted the extensions folder and installed it again. Still not working.

I'm at a total loss now.

OS: Windows 10 Home 1809 VS-code: 1.36.0 Extension version: the latest.

Edit: I also reinstalled VS-Code and it's still the same error.

MrTucks avatar Jul 07 '19 19:07 MrTucks

you can check you php path, can you execute php without full path? php -v

junstyle avatar Jul 10 '19 01:07 junstyle

C:\Users\linus>php -v
PHP 5.6.40 (cli) (built: Jan  9 2019 15:10:36)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

I can

MrTucks avatar Jul 11 '19 15:07 MrTucks

see: https://github.com/junstyle/vscode-php-cs-fixer/issues/91

junstyle avatar Jul 12 '19 01:07 junstyle

I don't think this helps :( because I'm on Windows 10. I tried a full path (to a folder without admin rights) and it also didn't help

MrTucks avatar Jul 12 '19 15:07 MrTucks

I have exact same problem - does not work with full path to my phar or with default settings

"php-cs-fixer.executablePath": "${extensionPath}\\php-cs-fixer.phar",
"[php]": {
    "editor.defaultFormatter": "junstyle.php-cs-fixer",
    "editor.formatOnSave": false
},
"php-cs-fixer.rules": "@PSR2",
"php-cs-fixer.formatHtml": true,

I get error 'executable path not found' every time Windows 10 / VS Code 1.44.0

vscode-pmaher avatar Apr 15 '20 17:04 vscode-pmaher

OK, I see what's happening here now ....If you have other PHP extensions installed in VS Code you may have the built in PHP features disabled.

Firstly I needed to add back in my settings.json path to php.exe :

"php.validate.executablePath": "C:/devserver/eds-binaries/php/php738vc15x86x190920053344/php.exe",

then downloaded php-cs-fixer.phar ad my working settings on Windows 10 are as follows:

    "php.validate.executablePath": "C:/devserver/eds-binaries/php/php738vc15x86x190920053344/php.exe",
    "php-cs-fixer.executablePath": "C:/Users/paulm/Downloads/php-cs-fixer.phar",
"[php]": {
    "editor.defaultFormatter": "junstyle.php-cs-fixer",
    "editor.formatOnSave": false
},
"php-cs-fixer.rules": "@PSR2",
"php-cs-fixer.formatHtml": true,

vscode-pmaher avatar Apr 15 '20 18:04 vscode-pmaher

I am using Windows 10

  1. I set up an openserver.exe
  2. I have installed Composer (Composer-Setup.exe)
  3. On windows 10, I added the composer to the PATH environment variable. I showed it on stackoverflow
  4. Install PHP-CS-FIXER Using Composer composer global require friendsofphp/php-cs-fixer
  5. Then i install HP-CS-FIXER VSCODE Extension

My settings in vscode, in settings.json

  "php.validate.executablePath": "C:\\OpenServer\\modules\\php\\PHP_8.1\\php.exe",
  "php-cs-fixer.executablePath": "C:\\Users\\Brendan\\.vscode\\extensions\\junstyle.php-cs-fixer-0.2.10\\php-cs-fixer.phar",
  "php-cs-fixer.executablePathWindows": "C:\\Users\\Brendan\\AppData\\Roaming\\Composer\\vendor\\bin\\php-cs-fixer.bat", 

These steps helped me. This solved my issue. 😉

brend8c avatar Jun 19 '22 10:06 brend8c

@brendan8c

vscode menu: Help -> Toggle Developer Tools in the console, you can find the error logs. please paste your logs if you can't resolve.

junstyle avatar Jun 19 '22 11:06 junstyle

junstyle I wrote a solution that helped me.

brend8c avatar Jun 19 '22 11:06 brend8c