       title: 'PHP Executable Path'
       default: 'php' # Let OS's $PATH handle the rest
 
+  _testBin: ->
+    title = 'linter-php: Unable to determine PHP version'
+    message = 'Unable to determine the version of "' + @executablePath +
+      '", please verify that this is the right path to PHP.'
+    try
+      helpers.exec(@executablePath, ['-v']).then (output) =>
+        regex = /PHP (\d+)\.(\d+)\.(\d+)/g
+        if not regex.exec(output)
+          atom.notifications.addError(title, {detail: message})
+          @executablePath = ''
+      .catch (e) ->
+        console.log e
+        atom.notifications.addError(title, {detail: message})
+
   activate: ->
     require('atom-package-deps').install('linter-php')
     @subscriptions = new CompositeDisposable
     @subscriptions.add atom.config.observe 'linter-php.executablePath',
       (executablePath) =>
         @executablePath = executablePath
+        @_testBin()
 
   deactivate: ->
     @subscriptions.dispose()
 
   provideLinter: ->
-    helpers = require('atom-linter')
     provider =
       name: 'PHP'
       grammarScopes: ['text.html.php', 'source.php']

{CompositeDisposable} = require 'atom'

module.exports =
  config:

      lint: (textEditor) =>
        filePath = textEditor.getPath()
        command = @executablePath
        return [] unless command?
        parameters = []
        parameters.push('--syntax-check')
        parameters.push('--no-php-ini')
