Installing XAMPP / WAMP / LAMP
To run PHP locally on your machine, you need a server environment. XAMPP, WAMP, and LAMP are the most common stacks used by developers based on their operating system.
🔸 XAMPP (Cross-platform: Windows, Linux, macOS)
- Download from: https://www.apachefriends.org
- Includes Apache, MySQL (MariaDB), PHP, and phpMyAdmin.
- Installation is straightforward — just follow the installer steps.
- After installation, open the XAMPP Control Panel and start Apache and MySQL.
- Place your project files inside the
htdocsdirectory (e.g.,C:/xampp/htdocs/your-project). - Access it via
http://localhost/your-projectin your browser.
🔸 WAMP (Windows Only)
- Download from: https://www.wampserver.com
- Includes Apache, MySQL, PHP, and phpMyAdmin.
- Run the installer and follow the setup instructions.
- After installation, launch WAMP and ensure the icon is green (meaning services are running).
- Place your PHP files inside the
wwwdirectory (e.g.,C:/wamp/www/your-project). - Access via:
http://localhost/your-project
🔸 LAMP (Linux Only)
- Use terminal to install each component:
sudo apt update
sudo apt install apache2
sudo apt install mysql-server
sudo apt install php libapache2-mod-php php-mysql
/var/www/html directory.sudo chown -R $USER:$USER /var/www/htmlsudo systemctl restart apache2http://localhost✅ Verify Installation
Create a file called index.php with the following code:
<?php
phpinfo();
?>
Save it in the root directory (htdocs, www, or /var/www/html) and open http://localhost/index.php to see PHP information.


