DMG
DMG

Reputation: 141

phpcs can not find php in Visual Studio Code

I have a question about Visual Studio Code and phpcs extension. I'm working in Ubuntu and I run in to problem, that VSCode could not start phpcs. It throws error: "/usr/bin/env: 'php': No such file or directory". I tried to run "vendor/bin/phpcs --version" from VSCode terminal and got same error. In same time "php -v" did work just fine. Then I tried to run same code in linux terminal and both commands worked there. After searching for solution I found solution, where suggested changing first line of phpcs file from "/usr/bin/env php" to direct php file location. And now all works. But it looks like a dirty way of fixing this issue. So, my question, is there any better solution for this problem?

Upvotes: 1

Views: 728

Answers (1)

Sammy
Sammy

Reputation: 365

Add

{
   "php.executablePath": "/path/to/PHP/bin"
}

to VS Code's settings.json

Upvotes: 1

Related Questions