Upgrading PHP for XAMPP on Windows

Been using XAMPP Portable on my Windows machine for some years now. Always a pain to upgrade the PHP version. Noting down the steps for future reference.

  • Run phpinfo() and check Architecture (x86, x64) and Thread Safety (enabled, disabled).
  • Go to https://windows.php.net/download and download the correct zip file for the new PHP version. You may also need to download and install the Visual Studio Redistributable, also available on the same page on the sidebar.
  • Copy the page source of phpinfo() and paste in https://xdebug.org/wizard.php to analyze and get the correct Xdebug DLL for the new PHP version. Take note of the instructions returned with the analysis.
  • Assuming XAMPP is currently installed in C:\xampp:
    • Backup C:\xampp\php to C:\xampp\php-backup.
    • Unzip the zip file from php.net and copy the contents to C:\xampp\php, overwriting existing files.
    • Backup C:\xampp\apache\bin to C:\xampp\apache\bin-backup.
    • Copy libeay32.dll, libssh2.dll, nghttp2.dll and ssleay32.dll from C:\xampp\php to C:\xampp\apache and C:\xampp\apache\bin.
    • Copy the Xdebug DLL to C:\xampp\php\ext and update C:\xampp\php\php.ini as per the instructions returned with the analysis on the Xdebug wizard page.
  • Restart Apache. You may need to restart Windows so that previous Apache processes are properly terminated.