From ac61989611135387ba5e737e9fe00ca5d0692497 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Fri, 20 Nov 2026 12:21:55 +0530 Subject: [PATCH] Restore missing legacy OCI DLLs and install PHP 8.3 OCI from PECL --- src/scripts/extensions/oci.ps1 | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/src/scripts/extensions/oci.ps1 b/src/scripts/extensions/oci.ps1 index 033006d6..3dfa9c3e 100644 --- a/src/scripts/extensions/oci.ps1 +++ b/src/scripts/extensions/oci.ps1 @@ -51,6 +51,32 @@ Function Get-Oci8DLL() { return $null } +# Function to restore OCI DLLs missing from a cached PHP build. +Function Add-BundledOci() { + $bundleVersion = $installed.FullVersion + # PHP 8.2.34 is the last Windows PHP 8.2 release containing the OCI DLLs. + if($version -eq '8.2' -and [version]$installed.Version -gt [version]'8.2.34') { + $bundleVersion = '8.2.34' + } + $threadSafety = if($ts) { '' } else { '-nts' } + $compiler = if($installed.VCVersion -ge 16) { 'vs' } elseif($version -eq '7.4') { 'vc' } else { 'VC' } + $asset = "php-$bundleVersion$threadSafety-Win32-$compiler$($installed.VCVersion)-$arch.zip" + $bundleDir = Join-Path ([IO.Path]::GetTempPath()) ([Guid]::NewGuid().ToString()) + New-Item -ItemType Directory -Path $bundleDir > $null + try { + Get-File -Url "$php_windows/releases/$asset" -FallbackUrl "$php_windows/releases/archives/$asset" -OutFile "$bundleDir\php.zip" + Expand-Archive -Path "$bundleDir\php.zip" -DestinationPath $bundleDir -Force + Get-ChildItem "$bundleDir\ext\php_*oci*.dll" | ForEach-Object { + $dll = Get-PhpExtension -Path $_.FullName + if($dll.PhpVersion -eq $version -and $dll.Architecture -eq $arch -and $dll.ThreadSafe -eq $ts) { + Copy-Item $_.FullName $ext_dir -Force + } + } + } finally { + Remove-Item $bundleDir -Recurse -Force + } +} + # Function to install oci8 and pdo_oci. Function Add-Oci() { Param ( @@ -63,7 +89,10 @@ Function Add-Oci() { try { $status = 'Enabled' Add-InstantClient - if($version -lt '8.4') { + if($version -lt '8.3') { + if(-not(Get-ChildItem "$ext_dir\php_$extension*.dll")) { + Add-BundledOci + } if($version -lt '5.6' -and $extension -eq 'oci8') { Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini } else {