配置SublimeLinter插件以使用PHP

时间:2022-01-13 02:59:27

I installed the SublimeLinter plugin for Sumblime-text-2 in Ubuntu 12.04.

我在Ubuntu 12.04中为Sumblime-text-2安装了SublimeLinter插件。

The PHP linting does not work. After an exhaustive search on the internet, I found out that I have to give the path to PHP in the sublimeLinter settings as below:

PHP linting不起作用。在互联网上进行了详尽的搜索之后,我发现我必须在sublimeLinter设置中给出PHP的路径,如下所示:

"sublimelinter_executable_map":
 {
     "php":"/usr/share/php"
 },

This was the path in the line include_path I found in the phpInfo(). But it does not work. I tried escaping the special characters, and other paths like /usr/share/php5, /usr/lib/php5, but nothing seems to work.

这是我在phpInfo()中找到的include_path行中的路径。但它不起作用。我试图转义特殊字符,以及其他路径,如/ usr / share / php5,/ usr / lib / php5,但似乎没有任何工作。

Can anyone help with the correct configuration, so that I can get the linter functionality to work?

任何人都可以帮助正确配置,以便我可以使linter功能工作?

Note: There has been a previous unanswered question here. I thought maybe I should ask it again, in a little more detail.

注意:这里有一个以前未回答的问题。我想也许我应该再问一次,更详细一点。

UPDATE: The original question has been answered and solves this question as well.

更新:原始问题已得到解答并解决了这个问题。

4 个解决方案

#1


20  

1- Install node.js. Which, by the way, is pretty darn awesome in its own right.
2- Open up Sublime Text, and close all open files.
3- Head to Preferences->Package Settings->SublimeLinter->Settings – User (it will be empty if you haven’t messed with it before), and insert the following:

1-安装node.js.顺便说一句,这本身就是非常棒的。 2-打开Sublime Text,关闭所有打开的文件。 3-前往首选项 - >包设置 - > SublimeLinter->设置 - 用户(如果之前没有弄乱,它将为空),并插入以下内容:

{

  "sublimelinter_executable_map":
    {
        "javascript":"C:/Program Files/nodejs/node.exe",
        "css":"C:/Program Files/nodejs/node.exe",
        "php":"C:/wamp/bin/php/php5.4.3/php.exe"
    }

}

This is also where you’d put paths to, say, php for linting. Make sure you get the path to node correct – this is the default location on a Windows 7 install. Save the file, close the file, and restart Sublime Text.

这也是你将路径放到例如用于linting的php的地方。确保您获得节点正确的路径 - 这是Windows 7安装的默认位置。保存文件,关闭文件,然后重新启动Sublime Text。

sources: http://fuzzytolerance.info/blog/2012/05/14/2012-05-15-getting-sublimelinter-running-on-windows/

#2


4  

For ubuntu system type in terminal:

对于终端中的ubuntu系统类型:

which php

and use the result in your php path (Preferences->Package Settings->SublimeLinter->Settings -User).

并在php路径中使用结果(Preferences-> Package Settings-> SublimeLinter-> Settings -User)。

In my case it's:

在我的情况下它是:

{
    "sublimelinter_executable_map": {
       "php": "/usr/bin/php"
    }
}

#3


1  

php.exe file path on Windows 7 didn't do the trick for me, while php-win.exe did:

Windows 7上的php.exe文件路径对我来说不起作用,而php-win.exe则:

{
    "sublimelinter_executable_map":
    {
        "php":"C:/php/php-win.exe"
    }
}

#4


0  

php-win.exe file path on Windows 7 didn't do the trick for me!!!

Windows 7上的php-win.exe文件路径对我来说没有办法!

"sublimelinter_executable_map":
{
    "javascript":"C:/Program Files/nodejs/node.exe",
    "php":"C:/xampp/php/php-win.exe",
    "css":"C:/Program Files/nodejs/node.exe"
}

#1


20  

1- Install node.js. Which, by the way, is pretty darn awesome in its own right.
2- Open up Sublime Text, and close all open files.
3- Head to Preferences->Package Settings->SublimeLinter->Settings – User (it will be empty if you haven’t messed with it before), and insert the following:

1-安装node.js.顺便说一句,这本身就是非常棒的。 2-打开Sublime Text,关闭所有打开的文件。 3-前往首选项 - >包设置 - > SublimeLinter->设置 - 用户(如果之前没有弄乱,它将为空),并插入以下内容:

{

  "sublimelinter_executable_map":
    {
        "javascript":"C:/Program Files/nodejs/node.exe",
        "css":"C:/Program Files/nodejs/node.exe",
        "php":"C:/wamp/bin/php/php5.4.3/php.exe"
    }

}

This is also where you’d put paths to, say, php for linting. Make sure you get the path to node correct – this is the default location on a Windows 7 install. Save the file, close the file, and restart Sublime Text.

这也是你将路径放到例如用于linting的php的地方。确保您获得节点正确的路径 - 这是Windows 7安装的默认位置。保存文件,关闭文件,然后重新启动Sublime Text。

sources: http://fuzzytolerance.info/blog/2012/05/14/2012-05-15-getting-sublimelinter-running-on-windows/

#2


4  

For ubuntu system type in terminal:

对于终端中的ubuntu系统类型:

which php

and use the result in your php path (Preferences->Package Settings->SublimeLinter->Settings -User).

并在php路径中使用结果(Preferences-> Package Settings-> SublimeLinter-> Settings -User)。

In my case it's:

在我的情况下它是:

{
    "sublimelinter_executable_map": {
       "php": "/usr/bin/php"
    }
}

#3


1  

php.exe file path on Windows 7 didn't do the trick for me, while php-win.exe did:

Windows 7上的php.exe文件路径对我来说不起作用,而php-win.exe则:

{
    "sublimelinter_executable_map":
    {
        "php":"C:/php/php-win.exe"
    }
}

#4


0  

php-win.exe file path on Windows 7 didn't do the trick for me!!!

Windows 7上的php-win.exe文件路径对我来说没有办法!

"sublimelinter_executable_map":
{
    "javascript":"C:/Program Files/nodejs/node.exe",
    "php":"C:/xampp/php/php-win.exe",
    "css":"C:/Program Files/nodejs/node.exe"
}