πŸ—‚οΈ Step 1: Locate Your XAMPP Folder

Navigate to the directory where XAMPP is installed (usually C:\xampp).

Rename the existing apache and php folders to keep them as backups. For example:

  1. php β†’ php-8.2.XX
  2. apache β†’ apache-8.2.XX

This helps you identify which version you're currently using and allows easy rollback if needed.

⬇️ Step 2: Download the Desired XAMPP Version

  1. Go to XAMPP SourceForge Downloads.
  2. Choose the version you want (make sure to select the ZIP version for Windows).
  3. You can choose either the regular (For PC) or portable version.
  4. Download and extract the ZIP file on your computer.

πŸ›‘ Step 3: Stop All XAMPP Services

Before making the switch:

  1. Open the XAMPP Control Panel.
  2. Stop Apache and MySQL (or any other running services).

This ensures no processes are using the old version.

πŸ“ Step 4: Copy Apache and PHP Folders

After extracting the ZIP:

  1. Open the extracted folder.
  2. Copy the apache and php folders.
  3. Paste them into your existing C:\xampp\ directory.

You should now have your new php and apache folders ready to go.

πŸ› οΈ Step 5: Update php.ini Paths

  1. Go to the newly copied php folder:
  2. Open php.ini in a text editor.
  3. Search for any paths starting with xampp\ and change them to match your actual path (e.g., C:\xampp\).

example

; Before
extension_dir = "xampp\php\ext"

; After
extension_dir = "C:\xampp\php\ext"

Update all relevant paths to avoid loading issues.

▢️ Step 6: Start Apache and PHP

Now that your new PHP version is in place:

  1. Start Apache from the XAMPP Control Panel.
  2. You’re all set!

To verify visit http://localhost/phpinfo.php in your browser to confirm the new PHP version is active.

πŸ” Step 7: How to Switch Back to a Previous PHP Version in XAMPP

Need to go back to your previous setup? It's easy if you've renamed and preserved your old php and apache folders.

πŸͺ„ Step-by-Step Rollback

  1. Stop all running services in the XAMPP Control Panel (Apache, MySQL, etc.).
  2. Go to your XAMPP directory (e.g., C:\xampp).
  3. Rename the current folders to reflect their version:
  4. php β†’ php-7.4.XX
  5. apache β†’ apache-7.4.XX
  6. Rename your previous version folders back to active:
  7. php-8.2.XX β†’ php
  8. apache-8.2.XX β†’ apache
  9. Double-check your php.ini in the restored php folder to make sure all paths are correct (e.g., C:\xampp\php\ext, etc.).