Specify the absolute path to the command (cmd).
Say $file is /path/to/file , then the command ['php', "$file"] expands to php /path/to/file . This is similar to executing the following commands on the command line:
$ php /path/to/file
Since the command ( php ) is relative, a search on the system path (on the linux system path in the PATH environment variable) is performed to find php .
You can specify the absolute path for the command. Say you have the following versions installed:
- /path/to/php/versions/7.0.0/bin/php
- /path/to/php/versions/5.5.0/bin/php
Then you can configure the command to use v7.0.0:
{ "cmd" : ["/path/to/php/versions/7.0.0/bin/php", "$file"], "file_regex": "php$", "selector" : "source.php" }
And v5.5.0:
{ "cmd" : ["/path/to/php/versions/5.5.0/bin/php", "$file"], "file_regex": "php$", "selector" : "source.php" }
And so on...
Further reading
source share