PHP CodeSniffer include_once error

thatdamnqa picture thatdamnqa · Jan 10, 2013 · Viewed 13.8k times · Source

I'm trying to install PHP CodeSniffer on OS X Mountain Lion - and I appear to be getting a strange problem

When running 'phpcs' I get the following error:

PHP Warning:  include_once(PHP/CodeSniffer/CLI.php): failed to open stream: No such
file or directory in /usr/lib/php/pear/bin/phpcs on line 31

PHP Warning:  include_once(): Failed opening 'PHP/CodeSniffer/CLI.php' for inclusion
(include_path='.;/usr/lib/php/pear/share/pear/') in /usr/lib/php/pear/bin/phpcs on line 31

PHP Fatal error:  Class 'PHP_CodeSniffer_CLI' not found in /usr/lib/php/pear/bin/phpcs
on line 34

The file /usr/lib/php/pear/share/pear/PHP/CodeSniffer/CLI.php exists, which is confusing me

Answer

axel freudiger picture axel freudiger · Mar 18, 2014

On my configuration the PHP/ path just wasn't where phpcs expected it. I solved it via creating symlink to the missing path.

go to pear directory and run:

ln -s share/pear/PHP/ PHP