Wednesday 11 September 2013

How to run php program?

I already introduced about what is PHP  and how to install XAMPP, Now in this tutorial i'll tell you how to write PHP program and run in the local server.

Step 1
Assume you have installed XAMPP in C drive
Go to C:\xampp\htdocs

Create your own folder, name it as akshay 




Stpe 2
Now write your first php program in notepad and save it to folder akshay name as "test.php"


<html>
<head>
  <title> My first php program </title>
</head>
<body>
<?php
             echo "<h3> PHP program to add tow real numbers.. </h3><br/>";
              $a = 10;
              $b = 12;
              $c = $a + $b;  //assignment operator
             echo "Addition:"  . $c;
?>
</body>
</html>


Step 3
Now double click on "XAMPP CONTROL PANEL" on desktop and START "Apache"



Step 4

Type localhost on your browser and press enter:
It will show you the following:



Step 5
Now type the following on the address bar in browser
http://localhost/akshay/
Below Screenshot shows php files created under folder "akshay"


Step 6
Click on "test.php" and it will give you following output


The RESULT is 22 by adding both the values.
This way you can run your php program in XAMPP server…

1 comment: