close

[Solved] Visual Studio Code: Unable to locate phpcs

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Visual Studio Code: Unable to locate phpcs in php. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Visual Studio Code: Unable to locate phpcs Error Occurs?

Today I get the following error Visual Studio Code: Unable to locate phpcs in php.

How To Solve Visual Studio Code: Unable to locate phpcs Error ?

  1. How To Solve Visual Studio Code: Unable to locate phpcs Error ?

    To Solve Visual Studio Code: Unable to locate phpcs Error and when i added this to VSCode settings at PHP CodeSniffer section this solve my problem.

  2. Visual Studio Code: Unable to locate phpcs

    To Solve Visual Studio Code: Unable to locate phpcs Error and when i added this to VSCode settings at PHP CodeSniffer section this solve my problem.

Solution 1

I had the same problem and i did this to fix it in my windows:

  1. You will Download the Composer (From here)
  2. Go to Vs code and open your terminal and run this commandcomposer global require squizlabs/php_codesniffer
  3. Go to (settings–> User Settings), then search PHP CodeSniffer
  4. Scroll to Executatble Path and type\Users\{user_name}\AppData\Roaming\Composer\vendor\bin\phpcs and restart VS code.

This works For me, I hope it Works for you too 😀

Solution 2

In my case and in Windows 10, composer located at:

C:\Users\{user_name}\AppData\Roaming\Composer\vendor\bin\

and when i added this to VSCode settings at PHP CodeSniffer section this solve my problem.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also, Read

Leave a Comment