← Back to Chapters

PHP Installing XAMPP Server

? PHP Installing XAMPP Server

? Quick Overview

XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache Friends. It helps developers run PHP and MySQL locally for testing and learning.

? Key Concepts

  • X — Cross-platform
  • A — Apache (web server)
  • M — MySQL / MariaDB (database)
  • P — PHP (server-side scripting)
  • P — Perl (scripting language)

? Syntax / Theory

XAMPP installs Apache, PHP, and MySQL in a single package. Apache handles HTTP requests, PHP processes server-side scripts, and MySQL stores application data.

? Steps to Install XAMPP

1. Download XAMPP

2. Install XAMPP

  • Run the installer file
  • Allow permissions if prompted
  • Keep default components selected
  • Choose install directory (example: C:\xampp)

3. Start Apache and MySQL

  • Open XAMPP Control Panel
  • Click Start for Apache and MySQL
  • Status should turn green

? Code Example

? View Code Example
// Simple PHP test file to verify PHP is working
<?php
echo "PHP is working!";
?>

? Live Output / Explanation

Open your browser and visit http://localhost/test.php. If PHP is configured correctly, the browser will display:

PHP is working!

? Interactive / Visual Understanding

When you access a PHP file through localhost, Apache sends the file to PHP, PHP executes the script, and the output is returned to the browser as HTML.

? Use Cases

  • Learning PHP and MySQL
  • Testing web applications locally
  • Developing projects without internet dependency

✅ Tips & Best Practices

  • Always place PHP files inside the htdocs folder
  • Use localhost or 127.0.0.1 to access projects
  • Check port conflicts if Apache does not start

? Try It Yourself

  • Install XAMPP and open Control Panel
  • Create test.php in htdocs and print your name
  • Use phpinfo(); to view PHP configuration