To run php command line on ubuntu,then you need installphp5-cli,its an command-line interpreter for the php5 scripting language.
$sudo apt-get install php5-cli
run below command to check where php is located
~$ which php
/usr/bin/php
for sample code example
<?
$dt=date(“Y-m-d”);
echo $dt.”\n”;
?>
save as datecheck.php
~$ php datecheck.php
2010-03-23