You need to install LAMP (Linux Apache, Mysql, PHP )Server.
Click Here How to install LAMP Sever in Ubuntu Linux
Now you can check your Apache webserver
Open a browser (firefox) and type http:// 127.0.0.1 in address bar
It Shows " It Works "
Now you can test your PHP
See your server root is pointed to the folder /var/www by default. So you have to save your programs in /var/www. But There is a problem, you can't write in to the folder /var/www as ordinary user, it needs root privilege . (I am using gksu for solving this proble, it will ask for your sudo password)
open a terminal type the following
$cd /var/www
$ gksu gedit helloworld.php
write the program
<?phpnow save and quit
echo "hello world";
?>
open browser (firefox)
type the following in the address bar
http://127.0.0.1/helloworld.php
Now You will get the result in the browser
" hello world"
Now your First PHP program is Working
write valuable comments for helping php beginners