Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Set-PHPVersion {
- param(
- [Parameter(Mandatory=$true)]
- [string]$Version
- )
- $php81Path = "C:\laragon\bin\php\php-8.1.10-Win32-vs16-x64"
- $php84Path = "C:\laragon\bin\php\php-8.4.6-Win32-vs17-x64"
- if ($Version -eq "81") {
- Write-Host "Setting PHP version to 8.1"
- [Environment]::SetEnvironmentVariable("Path", "$php81Path;$env:Path", "Machine")
- }
- elseif ($Version -eq "84") {
- Write-Host "Setting PHP version to 8.4"
- [Environment]::SetEnvironmentVariable("Path", "$php84Path;$env:Path", "Machine")
- }
- else {
- Write-Host "Usage: Set-PHPVersion -Version [version] (e.g., Set-PHPVersion -Version 81 or Set-PHPVersion -Version 84)"
- }
- Write-Host "Please close and reopen your terminal for the changes to take effect."
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement