Php linter - "failed to spawn command phpmd"


#1

I have added the linter package to Atom and I have been able to successfully add linters for javascript and xml but not PHP. When I add one of the php linters I get the following error “Uncaught BufferedProcessError: Failed to spawn command phpmd. Make sure phpmd is installed and on your PATH”

php is in my PATH and I have added the following to config.cson.

‘linter-phpmd’:
‘phpExecutablePath’: ‘/Applications/MAMP/bin/php/php5.6.2/bin/’

Am I missing something?


#2

Here is some more information for preemptive flame prevention :smile:

Atom - Version 0.158.0 (0.158.0)
linter - 0.9.0
OSX - 10.9.5


#3

Well, it is saying php​md should be in your PATH, not php. Have you double-checked that?

Also:

  1. You might want to update to the latest version of Atom
  2. Including the OS and OS version you’re running is sometimes helpful as well (it appears to be OS X, but confirmation is always good)

#4

phpmd is in /Applications/MAMP/bin/php/php5.6.2/bin/ and I can execute it from any location so I think I am good there. I just updated Atom to 0.161.0 but the error is still there

OSX is version 10.9.5

Thanks


#5

I think I may have found the solution. If I run atom from the terminal or add this to init.coffee (open > your init script) it works ok.

process.env.PATH = ["/Applications/MAMP/bin/php/php5.6.2/bin", process.env.PATH].join(":")


#6

I think you need your config.cson file to have ‘phpmdExecutablePath’ rather than ‘phpExecutablePath’