Objective:
The objective of this lab is to guide you through the process of installing XAMPP on your computer and testing its functionality by running a PHP website.
Prerequisites:
- A computer running Windows, macOS, or Linux
- Internet connection
- Basic understanding of computer operations
Part 1: Installing XAMPP
Step 1: Downloading XAMPP
- Open a web browser and navigate to the XAMPP official website.
- Click on the “Download” button to download the latest version of XAMPP suitable for your operating system (Windows, macOS, Linux).
Step 2: Installing XAMPP
For Windows:
- Locate the downloaded XAMPP installer (e.g.,
xampp-windows-x64-7.4.24-1-VC15-installer.exe). - Double-click on the installer to launch the installation wizard.
- Follow the on-screen instructions to install XAMPP. Make sure to select the components you want to install, such as Apache, MySQL, PHP, and phpMyAdmin.
For macOS:
- Locate the downloaded XAMPP DMG file (e.g.,
xampp-osx-7.4.24-1-installer.dmg). - Double-click on the DMG file to mount it.
- Drag the XAMPP folder to the Applications folder.
- Open the XAMPP folder in the Applications folder and double-click on the “manager-osx” application to start XAMPP.
For Linux:
- Open a terminal window.
- Navigate to the directory where the XAMPP installer is downloaded.
- Give execute permission to the installer using the command:
chmod +x xampp-installer.run. - Run the installer with the command:
sudo ./xampp-installer.run. - Follow the on-screen instructions to complete the installation.
Step 3: Starting XAMPP
- Open the XAMPP control panel.
- Start the Apache and MySQL services by clicking on the “Start” buttons next to them.
Part 2: Testing XAMPP with a PHP Website
Step 4: Creating a PHP Website
- Navigate to the XAMPP installation directory (
C:\xamppon Windows,/Applications/XAMPPon macOS, or/opt/lamppon Linux). - Go to the
htdocsfolder. - Create a new folder named
phpwebsite. - Inside the
phpwebsitefolder, create a new file namedindex.php. - Open
index.phpwith a text editor (e.g., Notepad, Visual Studio Code) and add the following PHP code:

PHP code
6. Save the index.php file and close the text editor.
Step 5: Accessing the PHP Website
- Open a web browser.
- Enter the following URL in the address bar:
- For Windows:
http://localhost/phpwebsite/index.php - For macOS and Linux:
http://localhost/phpwebsite/index.php
- For Windows:
- Press Enter to navigate to the PHP website.
- You should see the message “Hello, World! This is a PHP website.” displayed on the webpage, indicating that XAMPP and PHP are working correctly.
Conclusion:
Congratulations! You have successfully installed XAMPP and tested its functionality by running a PHP website. You can now use XAMPP to develop and test PHP applications on your computer.