PHP Installation in Local Server Using XAMPP (With Video)

You can start learning the basics of programming in PHP with the help of any of the online PHP compilers freely available on the Internet. This will help you get acquainted with the features of PHP without installing it on your computer. Later on, you can install a full-fledged PHP environment on your local machine.

Software Components of XAMPP

XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache Friends. It includes key components required to run PHP-based web applications locally.

  • Apache – Acts as the main web server that processes HTTP requests. It's the default server bundled in XAMPP and is widely used globally.

  • MySQL – Serves as the database management system in XAMPP. It's open-source, fast, and reliable for managing structured data.

  • PHP – A powerful server-side scripting language used for developing dynamic websites and applications. It works seamlessly with MySQL and is embedded into HTML.

  • Perl – A high-level programming language focused on text processing and is often used in web development and system administration.


Steps to Install XAMPP on Windows

  1. Download XAMPP
    Visit the official Apache Friends website and download the installer for XAMPP (recommended: version 7.4).

  2. Run the Installer
    Open the downloaded file and proceed with the installation. You can leave the default components selected (MySQL, PHP, phpMyAdmin) and click Next.

  3. Bitnami Option
    Uncheck the option “Learn more about Bitnami for XAMPP” and proceed by clicking Next.

  4. Choose Installation Folder
    Set the root installation path (e.g., C:\xampp). This will be the base directory that includes the htdocs folder where your projects will reside.

  5. Firewall Access
    Allow XAMPP to pass through Windows Firewall when prompted.

  6. Finish Setup
    After the installation, click Finish to complete the setup and launch the XAMPP Control Panel.

  7. Start Apache & MySQL
    In the control panel, click Start beside Apache and MySQL to start the local server.

    Note: If Apache doesn’t start, another service might be using port 80. You may need to stop that service or change the Apache port in the config.


Testing Your Local Server

  1. Visit Localhost
    Open your browser and type:
    http://localhost
    If XAMPP is installed correctly, the XAMPP welcome page will be displayed.

  2. Create a PHP File
    Go to the folder C:\xampp\htdocs, and create a new file called test.php. Paste the following code:

    <?php phpinfo(); ?>
  3. Run the PHP Script
    Open your browser and go to:
    http://localhost/test.php
    If you see the PHP information page, then PHP is working correctly in your local server.


Project Folder Structure

To organize your projects:

  • Inside the htdocs folder, create a sub-folder (e.g., learning)

  • Create a file like helloWorld.php inside that folder

  • Access it via http://localhost/learning/helloWorld.php

Web servers usually look for an index.php or index.html file as the default landing page.


Watch the Video Tutorial

For a complete walkthrough of installing XAMPP 7.4, configuring Sublime Text, and verifying PHP using phpinfo(), check out the video tutorial:



Configuration Tips

  • All configuration files are located inside:
    C:\xampp\apache, C:\xampp\mysql, and C:\xampp\php

  • Restart Apache or MySQL after making changes to config files.