2013-05-29 16:25

修复Cygwin Emacs flycheck模式错误在运行xampp php的win7中查找/ tmp和phpcs

  • cygwin
  • php
  • emacs

Issue with Errors

Have been using Emacs for a couple years. Recently decided to try the Prelude version (link to prelude). Install went smoothly (on Win7 with Cygwin), but have been unable to use php error checking for a couple days. I want to get php error checking to work with Flycheck. It is non-functioning for me right now.

Currently, when I break a php script, flycheck.el (@ln2551) returns 2 errors:

Checker php returned non-zero exit code 1, but no errors from output: 
Could not open input file: /tmp/flycheck4728Btc/myPhpFile.php

Checker definition probably flawed.
Checker php-phpcs returned non-zero exit code 1, but no errors from output:
Could not open input file: /cygdrive/c/xampp/php/phpcs

Checker definition probably flawed.

Debug Info

1). Flycheck writes a buffer copy in Cygwin root /tmp directory. See flycheck.el (@ln800)): This file exists and is a confirmed readable buffer copy; there is no a problem with its file permissions (same error whether chmod 777 or 700).

2). Phpcs is located at c:/xampp/php/phpcs and can be called from the command line (cmd.exe and cygwin bash) with or without the c:/ path; but does not work with the cygdrive path. [This does NOT work $/cydrive/c/xampp/php/phpcs -h (with or without the .bat extension).] I have also confirmed good installation of phpcs (and it works from command line), and that there is not a file permission issue here. I have set the flychech-phpcs-standard variable to c:/xampp/php/phpcs as per flycheck.el @ln2895-2903 but have not found the condition that throws throws the error.

[Note: This error did go away when I tried renaming the phpcs file and specifying the phpcs.bat, but I am not sure sure whether the checker was found or not since the write to tmp file error still thwarted any results. Also, that broke my commandline usage of the phpcs command.]

Just to be sure, here is my php -v:

$ php -v
PHP 5.4.7 (cli) (built: Sep 12 2012 23:48:31)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans

Here is my phpcs version:

$ phpcs --version
PHP_CodeSniffer version 1.3.3 (stable) by Squiz Pty Ltd. (

And have this alias in my .bash_profile: alias phpcs="c:/xampp/php/phpcs"

And c:\xampp\php on my PATH


I been going through the phpcs, cygwin, and the flycheck.el, including the instructions to customize the flycheck-phpcs-standard lines and have not made any progress on this issue.

I am unsure whether this has something to do with the comments on flycheck.el@800-824 (defun flycheck-temp-file-system (filename prefix) or not. Those are comments about hacking around a compression bug with Emacs. Anyway,

How to fix this?

Any comments or ideas to test this further? Anyone have flycheck working on win7 with Cygwin? Is it an operating systemn compile issue? Directory paths in scripts somewhere?

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享