From 92b4784fb6e277d906775481dd8f478e52d54a70 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Thu, 25 Nov 2021 23:24:48 +0530 Subject: [PATCH] Suppress error in Get-Php run before PHP setup in win32.ps1 --- src/scripts/win32.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index 06e1b724..f7d3f71f 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -508,7 +508,13 @@ Step-Log "Setup PHP" $installed = $null if (Test-Path -LiteralPath $php_dir -PathType Container) { try { - $installed = Get-Php -Path $php_dir + if(Test-Path $php_dir\php.ini) { + Rename-Item -Path $php_dir\php.ini -NewName 'php.ini.bak' + } + $installed = Get-Php -Path $php_dir -ErrorAction SilentlyContinue 2>$null 3>$null + if(Test-Path $php_dir\php.ini.bak) { + Rename-Item -Path $php_dir\php.ini.bak -NewName 'php.ini' + } } catch { } } $status = "Installed"