0

I'm running into an issue trying to get codesniffer working with Xampp (1.7.1). I've got pear running by editing the include_path in php.ini.

When I try to run phpcs I get the following errors:

Warning: include_once(PHP/CodeSniffer/CLI.php): failed to open stream: No such file or directory in C:\xampp\php\phpcs on Line 31

Warning: include_once(): Failed opening 'PHP/Codesniffer/CLI.php' for inclusion (include_path="\xampp\php\pear") in C:\xampp\php\phpcs on line 31

Fatal error: Class 'PHP_CodeSniffer_CLI' not found in C:\xampp\php\phpcs on line 34

Anyone have any idea what's going on here?

andrewsi
  • 10,807
  • 132
  • 35
  • 51
Matt
  • 1
  • 1
  • 1

2 Answers2

0

It definitely sounds like the PHP include path is wrong, even though PEAR itself is working. It is a bit strange though.

Do you have a \xampp\php\pear\PHP\CodeSniffer\CLI.php file? If not, can you find where it is under the \xampp\php\pear directory?

If it is, for example, actually at \xampp\php\pear\source\pear\PHP\CodeSniffer\CLI.php then you'll need to change your include_path to be \xampp\php\pear\source\pear. But this could then break your PEAR install, which probably means PEAR is not configured correctly.

If this is the case, it's worth uninstalling PHP_CodeSniffer, changing the location of PEAR's php_dir configuration variable, and then reinstalling PHP_CodeSniffer.

For example:

pear uninstall php_codesniffer
pear config-set php_dir \xampp\php\pear
pear install php_codesniffer

(sorry, I'm not sure if pear on windows requires the drive letter in the path, so just check the current value using pear config-get php_dir and adjust the path based on that format.)

I hope that info helps you move forward a bit.

Greg Sherwood
  • 6,992
  • 2
  • 29
  • 24
0

PEAR might have also setup an include path in the phpcs executable (-d include_path="''") which is overriding the default. This is particularly annoying if you forget to create a default php.ini file until after phpcs is installed.

Colin
  • 1