-
Notifications
You must be signed in to change notification settings - Fork 439
Expand file tree
/
Copy pathinstall.ps1
More file actions
57 lines (45 loc) · 1.97 KB
/
install.ps1
File metadata and controls
57 lines (45 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#Requires -Version 5.1
<#
.SYNOPSIS
Downloads and installs the latest FrankenPHP release for Windows.
.DESCRIPTION
This script downloads the latest FrankenPHP Windows release from GitHub
and extracts it to the specified directory (~\.frankenphp by default).
Usage as a one-liner:
irm https://github.com/php/frankenphp/raw/refs/heads/main/install.ps1 | iex
Custom install directory:
$env:FRANKENPHP_INSTALL = 'C:\frankenphp'; irm https://github.com/php/frankenphp/raw/refs/heads/main/install.ps1 | iex
#>
$ErrorActionPreference = "Stop"
if ($env:FRANKENPHP_INSTALL) {
$BinDir = $env:FRANKENPHP_INSTALL
} else {
$BinDir = Join-Path $HOME ".frankenphp"
}
Write-Host "Downloading FrankenPHP for Windows (x64)..." -ForegroundColor Cyan
$tmpZip = Join-Path $env:TEMP "frankenphp-windows-$PID.zip"
try {
Invoke-WebRequest -Uri "https://github.com/php/frankenphp/releases/latest/download/frankenphp-windows-x86_64.zip" -OutFile $tmpZip
} catch {
Write-Host "Download failed: $_" -ForegroundColor Red
exit 1
}
Write-Host "Extracting to $BinDir..." -ForegroundColor Cyan
if (-not (Test-Path $BinDir)) {
New-Item -ItemType Directory -Path $BinDir -Force | Out-Null
}
try {
Expand-Archive -Force -Path $tmpZip -DestinationPath $BinDir
} finally {
Remove-Item $tmpZip -Force -ErrorAction SilentlyContinue
}
Write-Host ""
Write-Host "FrankenPHP downloaded successfully to $BinDir" -ForegroundColor Green
# Check if the directory is in PATH
$inPath = $env:PATH -split ";" | Where-Object { $_ -eq $BinDir -or $_ -eq "$BinDir\" }
if (-not $inPath) {
Write-Host "Add $BinDir to your PATH to use frankenphp.exe globally:" -ForegroundColor Yellow
Write-Host " [Environment]::SetEnvironmentVariable('PATH', `"$BinDir;`" + [Environment]::GetEnvironmentVariable('PATH', 'User'), 'User')" -ForegroundColor Gray
}
Write-Host ""
Write-Host "If you like FrankenPHP, please give it a star on GitHub: https://github.com/php/frankenphp" -ForegroundColor Cyan