How to Switch from PHP 7.4 to PHP 8.4 in XAMPP (and Upgrade phpMyAdmin)

Still running your local development environment on PHP 7.4? PHP 7.4 reached end of life on November 28, 2022, so it no longer gets security fixes, and more Composer packages, frameworks and plugins drop support for it every year.

Moving to PHP 8.4 gives you newer language features such as property hooks and asymmetric visibility, stricter type handling that exposes hidden bugs, and a supported runtime.

Swapping PHP alone is not enough, though. The phpMyAdmin copy that shipped with an older XAMPP can throw errors and deprecation notices on PHP 8.4, so it needs an upgrade too.

This tutorial shows you how to run PHP 8.4 next to PHP 7.4 in XAMPP on Windows, set up a virtual host for it, and install a compatible phpMyAdmin, without breaking your existing projects.

Why Upgrade from PHP 7.4 to PHP 8.4

  • Security: PHP 7.4 is end of life, so newly found vulnerabilities are not patched.
  • Modern features: PHP 8.x adds union types, attributes, match expressions, enums, readonly properties and, in 8.4, property hooks.
  • Better performance: engine improvements since PHP 8.0, including the JIT compiler, speed up many workloads. Gains vary, so benchmark your own project.
  • Stricter code: PHP 8.4 reports problems that older versions ignored, which leads to more reliable code.
  • Compatibility: current phpMyAdmin releases and most modern packages target PHP 8.

Planning to move a whole application, not just your local setup? Read our complete guide to migrating from PHP 7 to PHP 8 for the breaking changes to fix first.

Before You Start: Requirements

  • XAMPP for Windows installed in C:\xampp (Apache and MySQL/MariaDB working).
  • Administrator access, needed to edit the Windows hosts file.
  • The Microsoft Visual C++ Redistributable (x64) that PHP 8.4 requires. The PHP for Windows download page links to the right version.
  • About 30 minutes.

Step 1: Back Up Your Local Data First

  1. Copy your project folders from C:\xampp\htdocs\ to a safe location.
  2. Open http://localhost/phpmyadmin and export every important database as an .sql file.

Step 2: Download and Install PHP 8.4 Inside XAMPP

Apache can load only one PHP module at a time. The safest way to keep both versions is to leave XAMPP’s default PHP alone and run PHP 8.4 as a separate CGI process for one virtual host.

  1. Open the official PHP for Windows download page and download the PHP 8.4 x64 zip. Choose Non Thread Safe, which is the recommended build when PHP runs through php-cgi.exe.
  2. Create a new folder named php84 inside C:\xampp\.
  3. Extract the zip into C:\xampp\php84\.
  4. In that folder, copy php.ini-development and rename the copy to exactly php.ini.

Step 3: Configure php.ini for PHP 8.4

Open C:\xampp\php84\php.ini in a text editor. Find each line below, remove the leading semicolon, and set the value shown:

These settings matter. Without extension_dir and mysqli, phpMyAdmin cannot connect to your database, and without cgi.force_redirect = 0 Apache can show a “Security Alert! The PHP CGI cannot be accessed directly” message.

While you are here, you can also raise upload_max_filesize, post_max_size and max_execution_time to suit large database imports.

Step 4: Configure Apache to Route PHP 8.4 Separately

This keeps your older projects on the default PHP while projects in a dedicated folder use PHP 8.4.

  1. Create the folder C:\xampp\htdocs\php84_project.
  2. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf in a plain text editor and make sure the line Include conf/extra/httpd-vhosts.conf is not commented out in C:\xampp\apache\conf\httpd.conf.
  3. Add the following blocks at the bottom of httpd-vhosts.conf:

Why two blocks? As soon as you define any VirtualHost on port 80, Apache serves the first one for every unmatched name. The first block keeps http://localhost working exactly as before.
  1. Open Notepad as Administrator, then open C:\Windows\System32\drivers\etc\hosts and add this line at the bottom:

Step 5: Upgrade phpMyAdmin to Prevent Version Crashes

The phpMyAdmin bundled with an older XAMPP was written for PHP 7.4 and can produce errors and deprecation messages on PHP 8.4. Install a current release in your PHP 8.4 project.

  1. Go to the official phpMyAdmin downloads page and download phpMyAdmin 5.2.3 or newer (the “all-languages” zip).
  2. Create the folder C:\xampp\htdocs\php84_project\phpmyadmin.
  3. Extract the downloaded files into that folder.
  4. Copy config.sample.inc.php to config.inc.php in the same folder, then set a secret and your local connection details:

Your databases are stored by MySQL/MariaDB, not by PHP, so nothing is lost by running a new phpMyAdmin against the same server. Use the same root credentials you used before.

Step 6: Restart Apache and Test

  1. In the XAMPP Control Panel, stop and start Apache.
  2. Create C:\xampp\htdocs\php84_project\info.php containing <?php phpinfo();.
  3. Open http://php84.local/info.php. The top of the page should read PHP Version 8.4.x with Server API CGI/FastCGI.
  4. Open http://php84.local/phpmyadmin and log in.
  5. Delete info.php when you are done.

Now http://localhost/phpmyadmin still opens the old setup on PHP 7.4, while http://php84.local runs your projects and the new phpMyAdmin on PHP 8.4.

Troubleshooting Common Errors

Problem Likely cause Fix
Browser downloads the .php file or shows source code Handler not applied Check the FilesMatch block and that httpd-vhosts.conf is included, then restart Apache.
“Security Alert! The PHP CGI cannot be accessed directly” cgi.force_redirect enabled Set cgi.force_redirect = 0 in C:\xampp\php84\php.ini.
“The mysqli extension is missing” in phpMyAdmin Extension not enabled or wrong extension_dir Set extension_dir and uncomment extension=mysqli and extension=mbstring.
HTTP 500 error or blank page PHP error hidden Check C:\xampp\apache\logs\error.log, and set display_errors = On in php.ini while developing.
PHP does not start, missing DLL message Visual C++ runtime absent Install the x64 Visual C++ Redistributable required by PHP 8.4.
php84.local will not open Hosts entry not saved Re-edit the hosts file as Administrator and flush DNS with ipconfig /flushdns.
Apache will not start Port 80 or 443 in use Stop IIS, Skype or other services using the port, or change Apache’s port.
Old code throws errors on PHP 8.4 Breaking changes since PHP 7.4 See our PHP 7 to PHP 8 migration guide.

Frequently Asked Questions

Can I run PHP 7.4 and PHP 8.4 together in XAMPP?

Yes. Leave XAMPP’s default PHP in place for existing projects and run PHP 8.4 through CGI in a separate virtual host such as php84.local, as shown above.

Is PHP 7.4 still supported?

No. PHP 7.4 reached end of life on November 28, 2022, and it no longer receives security fixes.

Which phpMyAdmin version should I use with PHP 8.4?

Use phpMyAdmin 5.2.3 or newer from the official site. Releases bundled with PHP 7.4 era XAMPP builds are more likely to show errors and deprecation notices on PHP 8.4.

Will upgrading PHP delete my databases or projects?

No. Projects live in htdocs and databases live in MySQL/MariaDB, and this method does not touch either. Still, back up both first, as in Step 1.

Is there an easier way than editing Apache?

Yes. You can install a newer XAMPP build that already bundles PHP 8 (check the Apache Friends website for current versions), or use a tool built for switching PHP versions, such as Laragon. The manual method above is best when you must keep your current XAMPP untouched.

Can I use this setup on a live server?

No. XAMPP with a passwordless root user is for local development only. Use a hardened server stack for production.

Conclusion

You now have PHP 8.4 and an up-to-date phpMyAdmin running beside your PHP 7.4 projects. Test your applications at http://php84.local, fix any PHP 8 incompatibilities, and move projects over one at a time. Once everything runs cleanly, you can retire the PHP 7.4 setup for good.

Sources: PHP supported versions, PHP for Windows downloads, phpMyAdmin downloads.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.