Although traditionally PHP scripts are executed by web servers, they can be run through Sublime. To set up a web server, I suggest you read the following: http://www.ntu.edu.sg/home/ehchua/programming/howto/WampServer_HowTo.html
You will learn how to set up a local server and run "PHP".
If you want to run PHP from the Sublime Text 2 console, you must go to:
Tools -> Build System -> New Build System...
and then edit the file as follows:
{ "cmd": ["/path/to/php", "$file"] }
where /path/to/php is something like /usr/local/bin/php on Linux / OS X or C:/WAMP/bin/php.exe on Windows (be sure to use the slash / ). Save the file as Packages/User/PHP.sublime-build , where Packages is the folder opened when you select Preferences -> Browse Packages... Then click Tools -> Build System -> PHP and press Ctrl + B to run the script (or Cmd + B on Mac). You should see the output, if any, in the assembly console that opens.
Make sure there are no errors in your PHP, and also make sure that PHP is configured correctly !
source share