RJParikh
RJParikh

Reputation: 4166

Unable to install PHP CodeSniffer in wamp or xampp in windows 10 system

I am trying to install code sniffer in my localhost but unable to install it.

System: Windows 10

PHP: PHP 5.4+

I have tried below methods.

  1. Open command prompt with administrative permissions (select “run as administrator “)
  2. Go to your php install directory. For example : \wamp\bin\php\php5.5.12
  3. Run this command "pear install PHP_CodeSniffer" OR "pear install --alldeps PHP_CodeSniffer"

Error:

D:\Projects\wamp\bin\php\php5.5.12>pear install PHP_CodeSniffer No releases available for package "pear.php.net/PHP_CodeSniffer" install failed

  1. Then run this command "pear clear-cache" and this also giving error like,

Error:

D:\Projects\wamp\bin\php\php5.5.12>pear clear-cache C:\Users\pcs9\AppData\Local\Temp\pear\cache does not exist or is not a directory

I have to use code sniffer "phpcs" and "phpcbf" but without install PHP_CodeSniffer its not worked.

Please help to resolve this error.

Thanks in advance!

Upvotes: 3

Views: 2594

Answers (1)

Tomas Votruba
Tomas Votruba

Reputation: 24280

PEAR is not the best way to install PHP packages nowadays.

You could try Composer:

composer require squizlabs/php_codesniffer --dev

Upvotes: 1

Related Questions