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 the use of XAMPP provides an easy transition from local server to live server. XAMPP is an AMP stack that 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 a 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.
Note: Suppose Apache is not starting, it means some other service is running at port 80. In this case, stop the other service temporarily and restart it.
Making server request: Open your web browser and check whether the XAMPP service has properly installed or not. Type in the URL: http://localhost. If you are able to see the default page for XAMPP, you have successfully installed your XAMPP Server.
To Check if PHP is Working: All the website related files are organized in a folder called htdocs and then run index.php file by using http://localhost/index.php or http://localhost.
Note: For every new website or application, its always better to create a different folder inside htdocs, to keep it organized and avoid confusion.
For example, if we create a folder geeksforgeeks and then create a file nameed as ‘helloWorld.php’. All the contents related to it are put inside the folder ‘geeksforgeeks’. So the root ‘URL’ of the website will be ‘http://localhost/geeksforgeeks/’. So any home page is accessed by typing the root URL in the browser. To see the output, just type ‘http://localhost/geeksforgeeks/helloWorld.php’.
Generally web servers look for index file (landing page) namely index.html or index.php in the root of the website folder. Go to /xampp/htdocs/ folder and create a file with .php extension (test.php) and type or copy the below code and save it.
Now open your browser and go to “http://localhost/test.php” if you see the
page same as below then PHP has successfully installed.
Note: In XAMPP, the configuration files of Apache, MySQL, PHP are located in C:\Program Files\xampp. For any configuration file changes, you need to restart Apache and MySQL.