System configuration:
Ubuntu 14.04 (64 bit) + Xampp installed (
/opt/lampp
) + Sublime text 3 (Build 3065 )
I am trying to create PHP Build System inside sublime text 3 with help of This interesting post but failed to do do. Please see my work and issue so far
Create new build via Tools > Build System > New Build System ... and save as
php.sublime-build
{
"cmd": ["php", "-l", "$file"],
"file_regex": "php$",
"selector": "source.php",
"working_dir": "${project_path:${folder:${file_path}}}"
}
Now When press Ctrl + B or F7 on a .php
file it gives below error
[Errno 2] No such file or directory: 'php'
[cmd: ['php', '-l', '/opt/lampp/htdocs/wish/make.php']]
[dir: /opt/lampp/htdocs/chrome]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
[Finished]
It seems php path issue , so added php path in that file
"cmd": ["/opt/lampp/bin/php", "-l", "$file"]
now Ctrl+B
gives no error in the console BUT gives info on status bar :
file build finished with 1 error (see the image below )
and it does not show the output in Sublime Text window which was expected behavior of this build system
what is the wrong here, Please correct me.
Reference : Sublime text Build system
I solved finally. below are the steps
Install
php5-cli
While installing , it will gives the php path something like this
Check the command line php with a
.php
file on terminal (Ctrl+Alt+T)it executed fine
edit
/home/keshav/.config/sublime-text-3/Packages/User/
php.build_systemchanged the path and remove
"-l"
which was second argumentRestart the sublime text and press
Ctrl+B
on a opened.php
and output of that file returns in Sublime window.( expected behavior ).Hope it help someone. :)