Sublime Text 3 - PHP Build System
Struggling with this quite a bit.
Trying to add a PHP build system is what I have:
{
"cmd" : ["php", "$file"],
"file_regex": "php$",
"selector" : "source.php"
}
Now, creating a file named test.php
that contains: <?php echo "Hello, World!"; ?>
throws this error:
[WinError 2] The system cannot find the file specified
[cmd: ['php', 'D:\\www\\sandbox\\php\\test.php']]
[dir: D:\www\sandbox\php]
PHP is definitely on mine PATH
and works php test.php
via the command line.
Can anyone shed some light?
source to share
You just need to change the path to your php.exe . For example, I am using wampserver, so my php.exe is under C:\wamp64\bin\php\php5.6.16
, thus the solution is:
{
"cmd": ["C:\\wamp64\\bin\\php\\php5.6.16\\php.exe", "$file"],
"file_regex": "php$",
"selector": "source.php"
}
It worked for me, good luck :)
source to share
This is the build system I am using to run php script in terminal / browser.
{
"shell_cmd": "php -l \"$file\"",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",
"selector": "embedding.php",
"variants":
[
{
"shell_cmd": "gnome-terminal -- bash -c \"php $file;echo;echo Press enter to exit...;read\"",
"name": "Run(terminal)"
},
{
"shell_cmd":"firefox \"localhost/$file_base_name.php\"",
"name":"Run on Server"
}
]
}
source to share