2

I installed Syntastic with pathogen for Vim. I'm coding PHP on Windows, when I type :SynasticInfo, I have no checkers available.

I can run php -l index.php on my terminal but when I run :!php -l % in Vim, another terminal opened with this error message:

"C:\Windows\system32\cmd.exe /c (php -l)
'php' isn't a system command etc..

I found these on the web:

but they didn't solve my problem.

Any ideas? Thank you.


I installed PHP of course and my PATH is correct too.

icc97
  • 11,395
  • 8
  • 76
  • 90
pal_crystal
  • 73
  • 1
  • 1
  • 7

2 Answers2

2

If you have not installed php, you should do it by installing XAMPP or PHP itself, find php.exe in the subdirectories and add the path of it to PATH variable.

bimlas
  • 2,359
  • 1
  • 21
  • 29
  • The path of php.exe is in PATH if you do echo $PATH inside vim? i don't know, when i type "echo $PATH" in vim, vim writes "$PATH" :x – pal_crystal May 28 '14 at 04:07
  • Hmm... What happens if you type `:!calc`? (it should open calculator) If it not works then something with your `PATH` variable causes the problem. Try to set it inside .vimrc to be the same as on your system. (`let $PATH = 'output of 'echo %PATH%' in cmd.exe`') – bimlas May 28 '14 at 06:05
  • :!calc open calculator – pal_crystal May 28 '14 at 06:43
  • 1
    Try to disable .vimrc (`gvim -u NONE file.php`), .gvimrc (`gvim -U NONE file.php`) and the plugins (`gvim --noplugin file.php`) and call `:!php -l %`. If the `php` executing, then one of these files causes the problem, you have to check that manually. For example if the .vimrc is the badguy, then try to comment the half of it and open the file in normal way with vim. If there is no probrem while calling `:!php -l %`, then the problematic line is in the commented part of it, thus you may to comment only the quarter of the .vimrc and so on... – bimlas May 28 '14 at 07:30
  • my Terminal says "gvim not found" when i try your commands, here is my PATH "C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Git\cmd;C:\wamp\bin\php\php5.4.16;C:\Program Files (x86)\Vim\vim74\gvim;" – pal_crystal May 28 '14 at 07:48
  • 1
    o_O `C:\Program Files (x86)\Vim\vim74\gvim`: you have to add only the PATH, not the executable itself. If i'm right `C:\Program Files (x86)\Vim\vim74\gvim` is an exe, so you should add `C:\Program Files (x86)\Vim\vim74` to $PATH. Maybe the same problem with `php`. – bimlas May 28 '14 at 07:52
  • Thank you very much! Problem came from this line in my _vrimc that i added to try to solve the problem : let $PATH=substitute(system("echo \$PATH"), "\r\*\n", "", "g"), i have not enough reputation to vote up :( – pal_crystal May 28 '14 at 08:06
  • I'm happy to help you. :) Just click on the white pipe under the vote-counter to accept this as answer. – bimlas May 28 '14 at 08:10
0

To save other's hunting through comments...

From OP's comment:

Problem came from this line in my _vimrc that I added to try to solve the problem:

let $PATH=substitute(system("echo \$PATH"), "\r*\n", "", "g")

As a result this was the PATH:

"...C:\wamp\bin\php\php5.4.16;C:\Program Files (x86)\Vim\vim74\gvim;"

Which as @bimlas points out is pointing directly at the executable files rather than the directory that they're contained in.

icc97
  • 11,395
  • 8
  • 76
  • 90