From 5bb2eed0aa7ee31dbc30598b182cd2f697cc1b63 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Sat, 28 Dec 2024 02:07:42 +0530 Subject: [PATCH] Fix oci extension support on Windows for PHP 8.4 and above --- src/scripts/extensions/add_extensions.ps1 | 4 ++++ src/scripts/extensions/oci.ps1 | 24 ++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/scripts/extensions/add_extensions.ps1 b/src/scripts/extensions/add_extensions.ps1 index dd96a4d1..cdc2189a 100644 --- a/src/scripts/extensions/add_extensions.ps1 +++ b/src/scripts/extensions/add_extensions.ps1 @@ -136,6 +136,10 @@ Function Add-Extension { { $params["Version"] = $extension_version } + # If extension for a different version exists + if(Test-Path $ext_dir\php_$extension.dll) { + Move-Item $ext_dir\php_$extension.dll $ext_dir\php_$extension.bak.dll -Force + } Install-PhpExtension @params Set-ExtensionPrerequisites $extension } diff --git a/src/scripts/extensions/oci.ps1 b/src/scripts/extensions/oci.ps1 index 3cd21308..033006d6 100644 --- a/src/scripts/extensions/oci.ps1 +++ b/src/scripts/extensions/oci.ps1 @@ -48,6 +48,7 @@ Function Get-Oci8DLL() { return $_ } } + return $null } # Function to install oci8 and pdo_oci. @@ -62,22 +63,17 @@ Function Add-Oci() { try { $status = 'Enabled' Add-InstantClient - if ($extension -eq "pdo_oci") { - Enable-PhpExtension pdo_oci -Path $php_dir - } else { - if(-not(Test-Path $ext_dir\php_oci8.dll)) { - $oci8DLL = Get-Oci8DLL - if($oci8DLL) { - Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll - } else { - $status = 'Installed and enabled' - Get-File -Url (Get-Oci8Url) -OutFile $php_dir\oci8.zip - Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force - } + if($version -lt '8.4') { + if($version -lt '5.6' -and $extension -eq 'oci8') { + Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini + } else { + Enable-PhpExtension $extension -Path $php_dir } - Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini + } else { + $status = 'Installed and enabled' + Add-Extension $extension >$null 2>&1 } - Add-Log $tick $extension $status + Add-ExtensionLog $extension $status Add-LicenseLog } catch { Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"