Skip to content Skip to sidebar Skip to footer

Create first php program using xampp - Step by step

Create first php program using xampp:-
     Download xampp(freeware) software from this link Download XAMPP, xampp software having Apache and MySQL.


Usage of XAMPP software:-
  Xampp is mainly design for designer and programmers to test their work on their own systems without access to the internet. Default many security features are disabled. Also xampp is help to create and manipulate database in MySQL and SQLite. Once the Xampp is installed on the local system we can use like server. Programs are should be stored in the "xampp\htdocs" location.

Steps of Installing Xampp software:-
1.Choose the language you want and press ok.

Choose the language xampp

2. Select the components, what you want to install and click next.

Install component in xampp


3. Few minutes wait for the installation progress, in this time all files are stored in the installation directory, default directory is (c:/xampp)

Installation progress in xampp application

4. After install the xampp software you can see the control panel like below screen,

xampp control panel

5. After installed, must restart your system because then only all the server services are started properly, then after only we can start the apache server and execute the programs.

xampp start apache and mysql server

6. After start the Apache server and MySQL you can access your server home DocumentRoot, typing "http://localhost" in the address bar. If you type this address to your browser then the "C:\xampp\htdocs\index.php" file will execute.

xampp localhost setting menu

Steps to create a php program and execute:-

1. First we need a editor for create the program like notepad, notepad++ or other php editors. My best choice is "php designer" or "notepad++".

notepad++ php editor



2.Write a php program and save it to "c:/xampp/htdoc/" directory you can create any directory or files inside that directory, in that below image I have create a name "example" directory and inside that directory create a php file "example.php"


php program saved location


3. You can execute this file in your browser like "http://localhost/example/example.php" this path will access the file local path is "c:/xampp/htdoc/example/example.php".


                          run php program output

Example Program:-
<?php
$value1=10;
$value2=20;
$Answer=$value1+$value2;
echo "<font color='red'>The Answer is : ".$Answer."</font>";
?>

Output:-

localhost path in xampp server
Advertisement







Post a Comment for "Create first php program using xampp - Step by step"