From 3c6644f237c0feaa0a2cce9f059e05009ae19deb Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 6 Feb 2020 05:24:45 +0530 Subject: [PATCH] Add support for old PHP versions on windows --- src/scripts/win32.ps1 | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 082fbe94..19eef46e 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -91,10 +91,7 @@ Function Add-Tool() { if (Test-Path $php_dir\$tool) { Remove-Item $php_dir\$tool } - if ($tool -eq "composer") { - Install-Composer -Scope System -Path $php_dir -PhpPath $php_dir - composer -q global config process-timeout 0 - } elseif ($tool -eq "symfony") { + if ($tool -eq "symfony") { Invoke-WebRequest -UseBasicParsing -Uri $url -OutFile $php_dir\$tool.exe Add-Content -Path $PsHome\profile.ps1 -Value "New-Alias $tool $php_dir\$tool.exe" > $null 2>&1 } else { @@ -113,9 +110,10 @@ Function Add-Tool() { Add-Extension curl >$null 2>&1 Add-Extension mbstring >$null 2>&1 Add-Extension xml >$null 2>&1 - } - if($tool -eq "cs2pr") { + } elseif($tool -eq "cs2pr") { (Get-Content $php_dir/cs2pr).replace('exit(9)', 'exit(0)') | Set-Content $php_dir/cs2pr + } elseif($tool -eq "composer") { + composer -q global config process-timeout 0 } if (((Get-ChildItem -Path $php_dir/* | Where-Object Name -Match "^$tool(.exe|.phar)*$").Count -gt 0)) { Add-Log $tick $tool "Added" @@ -202,7 +200,12 @@ if ($null -eq $installed -or -not("$($installed.Version).".StartsWith(($version $installed = Get-Php -Path $php_dir Set-PhpIniKey -Key 'date.timezone' -Value 'UTC' -Path $php_dir -Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir +if($version -lt "5.5") { + Add-Extension openssl >$null 2>&1 + Add-Extension curl >$null 2>&1 +} else { + Enable-PhpExtension -Extension openssl, curl, opcache -Path $php_dir +} Update-PhpCAInfo -Path $php_dir -Source CurrentUser if ($version -eq 'master') { if($installed.ThreadSafe) {