linux - 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?
Answer
Solution:
Add
{
"php.executablePath": "/path/to/PHP/bin"
}
to VS Code'ssettings.json
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: method illuminate\database\eloquent\collection::paginate does not exist.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.