Certainly! XAMPP is a popular cross-platform web server solution stack package developed by Apache Friends. It includes an Apache HTTP server, MySQL database, PHP, and Perl. Here are step-by-step instructions to install PHP with XAMPP:
Step 1: Download XAMPP
- Visit the official XAMPP website at https://www.apachefriends.org/index.html.
- Click on the “Download” button to go to the download page.
- Choose the version of XAMPP suitable for your operating system (Windows, Linux, or macOS). Click on the download link to start the download.
Step 2: Install XAMPP
For Windows:
- Double-click the downloaded installer file (e.g.,
xampp-windows-x64-7.4.27-0-VC15-installer.exe
) to start the installation. - Follow the on-screen instructions. You can choose the components you want to install. At least, make sure “Apache” and “PHP” are selected.
- Choose the installation directory (default is usually
C:\xampp
), and click “Next” to proceed. - During the installation, you may be prompted by the Windows Defender Firewall. Allow access for Apache HTTP Server.
- Complete the installation process.
For Linux:
- Open a terminal and navigate to the directory where the downloaded installer is located.
- Give execute permissions to the installer:bashCopy code
chmod +x xampp-linux-x64-7.4.27-0-installer.run
- Run the installer:bashCopy code
sudo ./xampp-linux-x64-7.4.27-0-installer.run
- Follow the on-screen instructions to complete the installation.
For macOS:
- Open the downloaded
.dmg
file. - Drag and drop the XAMPP icon into the “Applications” folder.
- Open the “Applications” folder and start XAMPP by double-clicking on the XAMPP icon.
Step 3: Start Apache and PHP
- Launch XAMPP. The process varies based on your operating system:
- Windows: Start XAMPP from the desktop shortcut or the Start Menu.
- Linux: Open a terminal and run
/opt/lampp/manager-linux-x64.run
. - macOS: Open XAMPP from the Applications folder.
- In the XAMPP Control Panel, click the “Start” button next to Apache. This starts the Apache web server.
Step 4: Test PHP Installation
- Open a web browser and enter the following URL:arduinoCopy code
http://localhost
- If XAMPP is installed correctly, you should see the XAMPP dashboard.
- To test PHP specifically, create a new file named
test.php
in thehtdocs
directory inside the XAMPP installation directory (e.g.,C:\xampp\htdocs
on Windows) and add the following code:phpCopy code<?php phpinfo(); ?>
- Open a web browser and navigate to
http://localhost/test.php
. You should see a page with detailed information about your PHP installation.
Congratulations! You have successfully installed PHP with XAMPP on your system. You can now start building and testing web applications locally.
Enjoy !
Cover Image : Image by freepik