Skip to content

Commit e366fc7

Browse files
committed
feat: Add troubleshooting guide for download failures during PHP installation
1 parent 43c7e42 commit e366fc7

1 file changed

Lines changed: 141 additions & 0 deletions

File tree

docs/download-fails.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# Download Fails
2+
3+
## Problem
4+
5+
Running `phat install [version]` fails to download PHP.
6+
7+
## Common Causes
8+
9+
1. No internet connection
10+
2. PHP version doesn't exist
11+
3. Network firewall blocking the download
12+
4. Windows PHP download site is temporarily down
13+
14+
## Solutions
15+
16+
### Solution 1: Check Your Internet Connection
17+
18+
Verify you can access the internet:
19+
20+
```powershell
21+
Test-NetConnection windows.php.net -Port 443
22+
```
23+
24+
If this fails, check your network connection.
25+
26+
### Solution 2: Verify the Version Exists
27+
28+
Check what versions are actually available:
29+
30+
```powershell
31+
phat list --php --global
32+
```
33+
34+
This fetches the current list of stable PHP versions from windows.php.net.
35+
36+
### Solution 3: Try a Different Version
37+
38+
The version you want might not be available for Windows. Try a different version from the list:
39+
40+
```powershell
41+
# Example: if 8.2.27 doesn't exist, try 8.2.26
42+
phat install 8.2.26
43+
```
44+
45+
### Solution 4: Manual Download
46+
47+
If automatic download fails, you can download manually:
48+
49+
1. Visit [PHP for Windows Downloads](https://windows.php.net/download/)
50+
2. Download the **Thread Safe (TS) x64** version
51+
3. Extract to `C:\xampp\php[version]`
52+
- Example: `C:\xampp\php8.2.27`
53+
4. Run `phat list` to verify it's detected
54+
55+
### Solution 5: Check Firewall/Antivirus
56+
57+
Your firewall or antivirus might be blocking downloads:
58+
59+
1. Temporarily disable your antivirus
60+
2. Try the download again
61+
3. Re-enable your antivirus after installation
62+
63+
### Solution 6: Use Archives
64+
65+
Older PHP versions are in the archives. Check:
66+
- [PHP Release Archives](https://windows.php.net/downloads/releases/archives/)
67+
68+
## Understanding Version Availability
69+
70+
### Thread Safe vs Non-Thread Safe
71+
72+
⚠️ **Important**: Phat only downloads **Thread Safe (TS)** versions because they're required for Apache module mode.
73+
74+
### Compiler Versions
75+
76+
PHP for Windows comes in different compiler versions:
77+
- **VS17** (Visual Studio 2022) - PHP 8.2+
78+
- **VS16** (Visual Studio 2019) - PHP 7.4 - 8.1
79+
- **VS15** (Visual Studio 2017) - Older PHP versions
80+
81+
Phat automatically tries the correct compiler version for your PHP version.
82+
83+
## Checking Download URL
84+
85+
If you want to verify the download URL manually:
86+
87+
For PHP 8.2.27, the URL would be:
88+
```
89+
https://windows.php.net/downloads/releases/php-8.2.27-Win32-vs17-x64.zip
90+
```
91+
92+
Try accessing this in your browser to see if it exists.
93+
94+
## Error Messages
95+
96+
### "Could not find PHP X.X.X for download"
97+
98+
This means the exact version doesn't exist on windows.php.net. Try:
99+
1. Check available versions: `phat list --php --global`
100+
2. Install a version from that list
101+
102+
### "Download failed - Connection refused"
103+
104+
Network issue. Check:
105+
1. Internet connection
106+
2. Firewall settings
107+
3. Proxy settings (if applicable)
108+
109+
### "Extraction failed"
110+
111+
The downloaded file might be corrupted:
112+
1. Delete the temp file: `C:\Users\[YourUser]\AppData\Local\Temp\phat_download\`
113+
2. Try downloading again
114+
115+
## Manual Installation Steps
116+
117+
If all else fails, install manually:
118+
119+
1. Download PHP from [windows.php.net](https://windows.php.net/download/)
120+
- Choose: **Thread Safe (TS) x64**
121+
122+
2. Extract to XAMPP directory:
123+
```
124+
C:\xampp\php8.2.27
125+
```
126+
127+
3. Copy `php.ini-development` to `php.ini`:
128+
```powershell
129+
Copy-Item "C:\xampp\php8.2.27\php.ini-development" "C:\xampp\php8.2.27\php.ini"
130+
```
131+
132+
4. Switch to the new version:
133+
```powershell
134+
phat switch 8.2.27
135+
```
136+
137+
## Related Resources
138+
139+
- [PHP Windows Downloads](https://windows.php.net/download/)
140+
- [PHP Release Archives](https://windows.php.net/downloads/releases/archives/)
141+
- [Back to Troubleshooting Index](TROUBLESHOOTING.md)

0 commit comments

Comments
 (0)