Sublime Forum

PHP Build System (Lint Check)

#1

I would like to make a PHP Build System for Sublime Text 2. I have most of the things I need already, as php has a built in lint check with the ‘-l’ switch, however it’s not quite working for me.

When ever I use Ctrl + B, I get the following output.

[Errno 2] No such file or directory [cmd: [u'php -l /home/dygear/phpLiteAdmin/phpliteadmin.php']] [dir: /home/dygear/phpLiteAdmin] [path: /usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games] [Finished]

That is from the following php.sublime-build file

{ "cmd": "php -l $file"] }

I tried using $FileName, but that just results in an empty parameter.


I’d also like to know of a good lineNumberRegex for parsing php error messages.

[code]dygear@Dygear-Ubuntu:~/phpLiteAdmin$ php -l phpliteadmin.php

Parse error: syntax error, unexpected ‘include_once’ (T_INCLUDE_ONCE) in phpliteadmin.php on line 89
Errors parsing phpliteadmin.php
[/code]

Any suggestions would be helpful.

0 Likes

#2

I’ve successfully write a build command like this:

{
    "cmd": "/usr/bin/php", "-l", "${file}"]
}

And I simply read the results in console…

0 Likes