Commit 4692bfe95c6 for php

commit 4692bfe95c628534cf38e741975f06c50c073df4
Author: Shivam Mathur <shivam_jpr@hotmail.com>
Date:   Wed Nov 4 12:49:18 2026 +0530

    Reduce flaky SQL Server setup failures in Windows CI (#25183)

diff --git a/.github/actions/setup-windows/action.yml b/.github/actions/setup-windows/action.yml
index a5fa4cdddcb..0b1946caefe 100644
--- a/.github/actions/setup-windows/action.yml
+++ b/.github/actions/setup-windows/action.yml
@@ -11,8 +11,7 @@ runs:
         mysql --port=3306 --user=root --password="" -e "ALTER USER 'root'@'localhost' IDENTIFIED BY 'Password12!'; FLUSH PRIVILEGES;"
     - name: Setup MSSQL
       shell: pwsh
-      run: |
-        choco install sql-server-express -y --no-progress --install-arguments="/SECURITYMODE=SQL /SAPWD=Password12!"
+      run: .github/scripts/windows/setup-mssql.ps1
     - name: Setup PostgreSQL
       shell: pwsh
       run: |
diff --git a/.github/scripts/windows/setup-mssql.ps1 b/.github/scripts/windows/setup-mssql.ps1
new file mode 100644
index 00000000000..73dd52e968c
--- /dev/null
+++ b/.github/scripts/windows/setup-mssql.ps1
@@ -0,0 +1,38 @@
+# https://learn.microsoft.com/en-us/troubleshoot/sql/azure-sql/sql-installation-fails-sector-size-error-azure-vm
+$ErrorActionPreference = 'Stop'
+
+$compatibleDrives = foreach ($driveLetter in 'C', 'D') {
+    if (!(Test-Path "${driveLetter}:\")) {
+        continue
+    }
+    try {
+        $disk = Get-Partition -DriveLetter $driveLetter | Get-Disk
+    } catch {
+        Write-Warning "Cannot determine the sector size of ${driveLetter}: $_"
+        continue
+    }
+    if ($disk.PhysicalSectorSize -in @(512, 4096)) {
+        $driveLetter
+    }
+}
+$driveLetter = $compatibleDrives | Select-Object -First 1
+if (!$driveLetter) {
+    throw 'Neither C: nor D: has a SQL Server-compatible physical sector size (512 or 4096 bytes).'
+}
+$installDir = "${driveLetter}:\SQLServer"
+Write-Host "Installing SQL Server in $installDir"
+
+$delay = 3
+for ($attempt = 1; $attempt -le 3; $attempt++) {
+    choco install sql-server-express -y --no-progress --install-arguments="/SECURITYMODE=SQL /SAPWD=Password12! /INSTANCEDIR=$installDir /INSTALLSQLDATADIR=$installDir"
+    $exitCode = $LASTEXITCODE
+    if ($exitCode -eq 0) {
+        exit 0
+    }
+    if ($exitCode -notin @(-1, 1, 404) -or (Test-Path $installDir) -or $attempt -eq 3) {
+        exit $exitCode
+    }
+    Write-Host "Retrying SQL Server setup in $delay seconds..."
+    Start-Sleep -Seconds $delay
+    $delay *= 2
+}