Install SublimeLinter-php on Windows

Daniel Uncategorized 7 Comments

I like to work with Sublime Text because of the many packages and simplicity. You can customize the applications in almost any way possible: color schemes, packages, settings and short cuts. And with the plugin SublimeLinter-php it is even possible to see your PHP errors before you save and run the file!

I had recommended Sublime to my colleague, however he is working on Windows which does not provide PHP out-of-the-box. And this is required for the SublimeLinter-php plugin to work. Even when you have installed it, it may not work. Therefore I have written this short tutorial how you can make the plugin work at your Windows computer. Mac users: You only have to follow step 3 through 7. By default, the Mac is friendly for this plugin.

Installation steps:

  1. Download the desired PHP version:
  2. Unzip the files into C:/PHP/
  3. Open Sublime.
  4. Press CTRL+SHIFT+P
  5. Enter  Install Package and choose Package Control: Install Package
  6. Enter SublimeLinter and click on enter to install.
  7. Do the same in step 5 and 6 for the package SublimerLinter-PHP.
  8. Open Preferences -> Package Settings -> SublimeLinter -> Settings – User
  9. Change in the paths key “windows”: [] to “windows”: [“C:/PHP/”]
  10. Save the file and restart Sublime.

Congratulations! SublimeLinter-php also works for you now (make sure you set the syntax to PHP). How can you find this error?:

  1. Install the packages.
  2. Enable debug output (Tools -> SublimeLinter -> Debug Mode)
  3. Restart Sublime.
  4. Press CTRL+`
  5. You can see all the debug  information including the following error:
    SublimeLinter: cannot locate 'php'

Comments 7

  1. “Congratulations! SublimeLinter-php also works for you now. ”
    Sorry to rain on your parade, but your directions do not work.
    Instead of installing PHP I am using path to php in my XAMPP.
    Should work, but guess what …
    Did you actually installed linter and it worked for you?

    1. :))
      You know, gods of internet sometimes ‘piss’ on us poor coders;))
      I hope my ‘wholesome’ way of writing does not offend your senses.
      As too linter, I just tried something to make linter work and … and it worked.
      You know what was that?
      I made sure that my php file had syntax set to php.
      ctrl+shift+p ->set syntax: php
      Sorry for previous email.

      1. Post

        Hi Jeff,

        I am happy that you have resolved the problem. I have updated the article to make sure that others will not have this problem.

        Ps I did test it on Windows since a colleague had this issue and it worked like a charm 🙂

  2. SublimeLinter: php activated: F:\xampp\php\php.exe
    SublimeLinter: jshint version query: C:\Users\ABHIJIT\AppData\Roaming\npm\jshint.cmd –version
    SublimeLinter: jshint version: 2.9.4
    SublimeLinter: jshint: (>= 2.5.0) satisfied by 2.9.4
    SublimeLinter: jshint activated: C:\Users\ABHIJIT\AppData\Roaming\npm\jshint.cmd
    Emmet: No need to update PyV8
    SublimeLinter: php: a.php [‘F:\\xampp\\php\\php.exe’, ‘-l’, ‘-n’, ‘-d’, ‘display_errors=On’, ‘-d’, ‘log_errors=Off’]
    SublimeLinter: ERROR: could not launch [‘F:\\xampp\\php\\php.exe’, ‘-l’, ‘-n’, ‘-d’, ‘display_errors=On’, ‘-d’, ‘log_errors=Off’]
    SublimeLinter: reason: [Errno 2] No such file or directory
    SublimeLinter: PATH: C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\nodejs\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Users\ABHIJIT\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\ABHIJIT\AppData\Local\Programs\Python\Python36-32\;F:\xampp\php;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Java\jdk1.8.0_111\bin;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\ABHIJIT\AppData\Roaming\npm
    SublimeLinter: jshint: a.php [‘C:\\Users\\ABHIJIT\\AppData\\Roaming\\npm\\jshint.cmd’, ‘–verbose’, ‘–filename’, ‘@’, ‘–extract=always’, ‘-‘]
    Package Control: Skipping automatic upgrade, last run at 2017-08-04 15:24:04, next run at 2017-08-04 16:24:04 or after

    1. Post

      I am sorry but I am not sure what exactly goes wrong here. I have tried to replicate the problem by installing Sublime on a Windows machine with Xampp. However, I was able to run this. Can you post the configuration you are using?

Leave a Reply

Your email address will not be published. Required fields are marked *