Hi Guest, Login

Training

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive

Run a PHP program in XAMPP Server

 
 

 

This post is basically for those who want to run their first program under php. I just want to give an introduction related to PHP before starting:

It is server-side scripting language for producing dynamic Web pages.PHP was originally created by RasmusLerdorf in 1995. Th full-form of PHP is a recursive name i.e. PHP Hypertext Preprocessor.

PHP program can be run under various like WAMP, XAMPP etc.

  • WAMP Server: this server is a web development platform which helps in creating dynamic web applications.
  • XAMPP Server: It is a free open source cross-platfrom web server package.

I am using XamppServer to run my program, you can download it from the following link:
http://www.apachefriends.org/en/xampp-windows.html
After downloading, just follow the following step to start xampp server:

Step1

Install XAMPP

Step2

Assume you installed xampp in C Drive.
Go to: C:\xampp\htdocs

Create your own folder, name it for example as tutorialspoint.

Step3

Now create your first php program in xampp and name it as “add.php”:

<html>
<head><title>Addition php</title></head>
<body>

<?php
  	# operator
	print "<h2>php program to add two numbers...</h2><br />";
              $val1 = 20;
              $val2 = 20;
              $sum = $val2 + $val2;   /* Assignment operator */
              echo "Result(SUM): $sum";
?>

</body>
</html>

Step4

Now double click on “XAAMP CONTROL PANEL” on desktop and START “Apache
(icon also appears on the bottom)

php

 

Step5

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

php1

Step6

Now type the following on browser:
http://localhost/tutorialspoint/
Below screenshot shows php files created under folder “tutorialspoint”

php2

Step7

Click on “add.php” and it will show the following:

php3

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

About us

We provide real application for executing that incredible idea our clients have. Joomhome is a leading Web designing solutions organization, servicing customers in US, UK, Canada, Brazil, Italy, Netherlands, Germany, Australia, Russia, Ireland, Israel, Nigeria, Spain and many more