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:
- Download the desired PHP version: http://windows.php.net/download/
- Unzip the files into C:/PHP/
- Open Sublime.
- Press CTRL+SHIFT+P
- Enter Install Package and choose Package Control: Install Package
- Enter SublimeLinter and click on enter to install.
- Do the same in step 5 and 6 for the package SublimerLinter-PHP.
- Open Preferences -> Package Settings -> SublimeLinter -> Settings – User
- Change in the paths key “windows”: [] to “windows”: [“C:/PHP/”]
- 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?:
- Install the packages.
- Enable debug output (Tools -> SublimeLinter -> Debug Mode)
- Restart Sublime.
- Press CTRL+`
- You can see all the debug information including the following error:
SublimeLinter: cannot locate 'php'
14 Responses
“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?
:))
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.
Jeff
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 🙂
Thanks that helped me. Jeff
“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?
:))
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.
Jeff
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 🙂
Thanks that helped me. Jeff
This helped me so much. Thank you!
This helped me so much. Thank you!
SublimeLinter: php activated: F:xamppphpphp.exe
SublimeLinter: jshint version query: C:UsersABHIJITAppDataRoamingnpmjshint.cmd –version
SublimeLinter: jshint version: 2.9.4
SublimeLinter: jshint: (>= 2.5.0) satisfied by 2.9.4
SublimeLinter: jshint activated: C:UsersABHIJITAppDataRoamingnpmjshint.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:ProgramDataOracleJavajavapath;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:Windowssystem32;C:Windows;C:WindowsSystem32Wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program Files (x86)AMDATI.ACECore-Static;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program Files (x86)SkypePhone;C:Program Filesnodejs;C:Program FilesMicrosoftWeb Platform Installer;C:UsersABHIJITAppDataLocalProgramsPythonPython36-32Scripts;C:UsersABHIJITAppDataLocalProgramsPythonPython36-32;F:xamppphp;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:Program FilesJavajdk1.8.0_111bin;C:Program Files (x86)Microsoft VS Codebin;C:UsersABHIJITAppDataRoamingnpm
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
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?
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
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?