|
| 1 | +# Permission Denied When Installing |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +Installation fails with permission errors when trying to install a new PHP version. |
| 6 | + |
| 7 | +## Cause |
| 8 | + |
| 9 | +Installing PHP versions requires write access to the XAMPP directory (`C:\xampp`), which typically requires administrator privileges. |
| 10 | + |
| 11 | +## Solution |
| 12 | + |
| 13 | +Run PowerShell as Administrator before installing PHP versions. |
| 14 | + |
| 15 | +### How to Run PowerShell as Administrator |
| 16 | + |
| 17 | +**Method 1: Start Menu** |
| 18 | +1. Press the `Windows` key |
| 19 | +2. Type "PowerShell" |
| 20 | +3. Right-click on "Windows PowerShell" |
| 21 | +4. Select "Run as Administrator" |
| 22 | + |
| 23 | +**Method 2: Win + X Menu** |
| 24 | +1. Press `Win + X` |
| 25 | +2. Select "Windows PowerShell (Admin)" or "Terminal (Admin)" |
| 26 | + |
| 27 | +**Method 3: From File Explorer** |
| 28 | +1. Open File Explorer |
| 29 | +2. Navigate to any folder |
| 30 | +3. Click "File" → "Open Windows PowerShell" → "Open Windows PowerShell as administrator" |
| 31 | + |
| 32 | +### After Opening as Administrator |
| 33 | + |
| 34 | +Once you have an administrator PowerShell window, run your install command: |
| 35 | + |
| 36 | +```powershell |
| 37 | +phat install 8.2.27 |
| 38 | +``` |
| 39 | + |
| 40 | +## Verifying Administrator Access |
| 41 | + |
| 42 | +To check if you're running as administrator, look for "Administrator" in the PowerShell window title: |
| 43 | + |
| 44 | +``` |
| 45 | +Administrator: Windows PowerShell |
| 46 | +``` |
| 47 | + |
| 48 | +Or run this command: |
| 49 | + |
| 50 | +```powershell |
| 51 | +([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) |
| 52 | +``` |
| 53 | + |
| 54 | +This should return `True` if you have administrator privileges. |
| 55 | + |
| 56 | +## Alternative: Run Specific Command as Admin |
| 57 | + |
| 58 | +If you don't want to open a new admin window, you can run a specific command with admin rights: |
| 59 | + |
| 60 | +1. Right-click on PowerShell/Terminal icon |
| 61 | +2. Select "Run as Administrator" |
| 62 | +3. In the admin prompt, run: `phat install [version]` |
| 63 | + |
| 64 | +## Common Permission Error Messages |
| 65 | + |
| 66 | +You might see errors like: |
| 67 | +- "Access to the path is denied" |
| 68 | +- "UnauthorizedAccessException" |
| 69 | +- "Administrator rights required" |
| 70 | + |
| 71 | +All of these indicate you need to run PowerShell as Administrator. |
| 72 | + |
| 73 | +## Related Resources |
| 74 | + |
| 75 | +- [Windows User Account Control](https://learn.microsoft.com/en-us/windows/security/application-security/application-control/user-account-control/) |
| 76 | +- [Back to Troubleshooting Index](TROUBLESHOOTING.md) |
0 commit comments