How to install XAMPP on Windows ?

XAMPP is the most popular software package which is used to set up a PHP development environment for web services by providing all the required software components. During the process of software deployment, most of the web servers use almost similar components, so use of XAMPP provides easy transition from local server to live server. XAMPP is a AMP stack which stands for Cross platform, Apache, MySQL, PHP, perl with some additional administrative software tools such as PHPMyAdmin (for database access), FileZilla FTP server, Mercury mail server and JSP Tomcat server.
Other commonly known software packages like XAMPP are WAMP, LAMP, and others.

The XAMPP server is used to test PHP pages. It works as local server. It contains a MySQL database to manage or save data on a local server.

Advantages of XAMPP:

  • It is free and easy to use and easily available for Windows, Linux and Mac OS .
  • It is a beginners friendly solution package for full stack web development.
  • It is a open source software package which gives a easy installation experience.
  • It is very simple and lightweight to create set up for development, testing and deployment.
  • It is a time-saver and provides several ways for managing configuration changes.
  • It handles many administrative tasks like checking the status and security.

Software components of XAMPP:

  • Apache plays the role of processing the HTTP request. It is the actual default web server application. It is the most popular web servers maintained by Apache Software Foundation.
  • MySQL The role of database management system in XAMPP is played by MySQL. It helps to store and manage collected data very efficiently. It is an open-source and most popular.
  • PHP is the server-side scripting language which stand for Hypertext Preprocessor. It is embedded with HTML code which interacts with the webserver. It is an open-source and work well with MySQL and has become a common choice for web developers.
  • Perl is the high-level programming language designed for text editing which serves purpose like web development and network programming.

Steps to install XAMPP on Windows:

  • In the web browser, visit Apache Friends and download XAMPP installer.
  • During the installation process, select the required components like MySQL, FileZilla ftp server, PHP, phpMyAdmin or leave the default options and click the Next button.
  • Uncheck the Learn more about bitnami option and click Next button.
  • Choose the root directory path to set up the htdocs folder for our applications. For example ‘C:\xampp’.
  • Click the Allow access button to allow the XAMPP modules from the Windows firewall.
  • After the installation process, click the Finish button of the XAMPP Setup wizard.
  • Now the XAMPP icon is clearly visible on the right side of start menu. Show or Hide can be set by using the control panel by clicking on the icon.
  • To start Apache and MySql, just click on the Start button on the control panel.

Creating Your First PHP Script

Now that you have successfully installed Xampp on your computer. In this section we will create a very simple PHP script that displays the text "Hello, world!" in the browser window.

Ok, click on the control-panel icon somewhere on your Windows task bar or inside xampp folder or select the "xampp directory" where it is installed and find xampp-control ,double click on it and a window will pop up, then start apache web server, Now got to the "htdocs" directory through navigating the C:\xampp\htdocs. Create a subdirectory in "htdocs" directory let's say "project".

Now open up your favorite code editor and create a new PHP file then type the following code:

// Display greeting message
echo "Hello, world!";

Now save this file as "hello.php" in your project folder (located at C:\xampp\htdocs\project), and view the result in your browser through visiting this URL: http://localhost/project/hello.php.

Alternatively, you can access the "hello.php" file through selecting the http://localhost/project option and then select the file .

PHP can be embedded within a normal HTML web page. That means inside your HTML document you can write the PHP statements, as demonstrated in the follwoing example:

<title>PHP Application</title>
// Display greeting message
echo 'Hello World!';

You will learn more about PHP Programming in upcoming chapters.