我正在尝试安装php代码嗅探器。我已经设法达到跑步后的地步
php /Users/ryanfernandes/pear/bin/phpcs --version
它显示信息。但是当我尝试通过
php /Users/username/pear/bin/phpcs /Users/username/development/htdocs/test.php
PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 155
Warning: fwrite() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 155
PHP Warning: stream_get_meta_data() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 206
Warning: stream_get_meta_data() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 206
PHP Warning: file_get_contents(): Filename cannot be empty in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 208
Warning: file_get_contents(): Filename cannot be empty in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 208
PHP Warning: fclose() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 209
Warning: fclose() expects parameter 1 to be resource, boolean given in /Users/username/pear/share/pear/PHP/CodeSniffer/Reporting.php on line 209
任何帮助都会非常感激。
由于
答案 0 :(得分:1)
从错误消息中,您看起来正在使用PHP_CodeSniffer版本1.5.4。 PHP_CodeSniffer使用tmpfile()函数创建临时文件。可以通过运行以下命令找到它创建的目录:
php -r 'echo sys_get_temp_dir().PHP_EOL;'
确保允许您写入该目录,因为tmpfile()方法显然返回FALSE,如果目录不可写,则最常发生这种情况。