Search code examples
phpmacosphpcodesniffer

PHP CodeSniffer include_once error


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


Solution

  • Found the problem - I was using the Windows separator (semi-colon) in the include_path instead of the Unix one (colon), so it should've been:

     .:/usr/lib/php/pear/share/pear/
    

    instead of

     .;/usr/lib/php/pear/share/pear/