How to Uninstall PHP in Windows 10

How to Uninstall PHP in Windows 10

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

How to Uninstall PHP in Windows 10

When you install PHP on Windows, especially via tools like valet-windows, the process often feels more like dropping a binary into your system than executing a standard uninstaller. The command you ran—Invoke-WebRequest fetching a script from a GitHub repository and executing it directly—bypasses traditional package managers. This means there is no "Uninstall" button waiting for you in the Control Panel or the Program and Features list. To remove PHP 7.1 cleanly, you have to reverse the installation steps manually while being careful not to break your Windows environment.

The first step involves identifying where the binaries actually live. Scripts fetched from valet-windows typically install PHP into a directory defined by an environment variable named VALET_PHP_PATH, or they default to %USERPROFILE%\php. You must locate this specific folder. Inside, you will find the core executable php.exe, along with supporting DLLs and configuration files like php.ini.

Deleting these files is not enough. The critical part of uninstalling PHP on Windows is removing its integration with the system shell. When you run . "$env:temp\php71.ps1", that script likely modified your current session's environment variables or added a path entry to your persistent user profile. If that script updated PATH in your registry under HKEY_CURRENT_USER\Environment or HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment, you need to revert those changes.

A common pitfall is assuming that deleting the files is sufficient without restoring the PATH variable. If PHP remains in your system PATH, running php -v from a new terminal might still return version information, confusing you or potentially causing conflicts if you later install XAMPP. To clean this up, open a PowerShell window and run:

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","User")

This resets the user-level PATH to its default state before Valet modified it. You may need to check your Registry Editor (regedit) under Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment if the installer wrote there as well, though most portable PHP setups stick to user profiles for safety.

Another consideration is the interaction with MySQL. Since you mentioned discovering that MySQL didn't come with the Valet package and are now planning to install XAMPP, you must ensure no residual processes are running. Before deleting files, open Task Manager and look for any lingering php.exe or mysqld.exe processes. Kill them if they exist. If you installed a separate MySQL server previously (not via Valet), you may need to use the provided uninstaller for that specific MySQL version before proceeding with XAMPP, as overlapping data directories can cause corruption.

When switching from a standalone PHP installation to XAMPP, you are effectively replacing the runtime environment. However, ensure you remove any lingering references in your IDE or text editor. If you have set php as the default interpreter in VS Code or PhpStorm, changing these settings won't work until the old binaries are gone and the new ones from XAMPP are pointing to the correct locations.

Finally, verify the cleanup by opening a fresh Command Prompt or PowerShell. Run where php. If it returns no output, your system is clean. You can then proceed with the XAMPP installer, which will set up its own isolated directory structure and environment variables, providing a more predictable setup for running local Laravel projects or other web applications.

Our network