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

  1. Visit the official XAMPP website at https://www.apachefriends.org/index.html.
  2. Click on the “Download” button to go to the download page.
  3. 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:

  1. Double-click the downloaded installer file (e.g., xampp-windows-x64-7.4.27-0-VC15-installer.exe) to start the installation.
  2. Follow the on-screen instructions. You can choose the components you want to install. At least, make sure “Apache” and “PHP” are selected.
  3. Choose the installation directory (default is usually C:\xampp), and click “Next” to proceed.
  4. During the installation, you may be prompted by the Windows Defender Firewall. Allow access for Apache HTTP Server.
  5. Complete the installation process.

For Linux:

  1. Open a terminal and navigate to the directory where the downloaded installer is located.
  2. Give execute permissions to the installer:bashCopy codechmod +x xampp-linux-x64-7.4.27-0-installer.run
  3. Run the installer:bashCopy codesudo ./xampp-linux-x64-7.4.27-0-installer.run
  4. Follow the on-screen instructions to complete the installation.

For macOS:

  1. Open the downloaded .dmg file.
  2. Drag and drop the XAMPP icon into the “Applications” folder.
  3. Open the “Applications” folder and start XAMPP by double-clicking on the XAMPP icon.

Step 3: Start Apache and PHP

  1. 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.
  2. In the XAMPP Control Panel, click the “Start” button next to Apache. This starts the Apache web server.
PHP with XAMPP
Image by freepik

Step 4: Test PHP Installation

  1. Open a web browser and enter the following URL:arduinoCopy codehttp://localhost
  2. If XAMPP is installed correctly, you should see the XAMPP dashboard.
  3. To test PHP specifically, create a new file named test.php in the htdocs directory inside the XAMPP installation directory (e.g., C:\xampp\htdocs on Windows) and add the following code:phpCopy code<?php phpinfo(); ?>
  4. 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