Skip to content

Commit 5bb2eed

Browse files
committed
Fix oci extension support on Windows for PHP 8.4 and above
1 parent 96fb539 commit 5bb2eed

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/scripts/extensions/add_extensions.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ Function Add-Extension {
136136
{
137137
$params["Version"] = $extension_version
138138
}
139+
# If extension for a different version exists
140+
if(Test-Path $ext_dir\php_$extension.dll) {
141+
Move-Item $ext_dir\php_$extension.dll $ext_dir\php_$extension.bak.dll -Force
142+
}
139143
Install-PhpExtension @params
140144
Set-ExtensionPrerequisites $extension
141145
}

src/scripts/extensions/oci.ps1

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Function Get-Oci8DLL() {
4848
return $_
4949
}
5050
}
51+
return $null
5152
}
5253

5354
# Function to install oci8 and pdo_oci.
@@ -62,22 +63,17 @@ Function Add-Oci() {
6263
try {
6364
$status = 'Enabled'
6465
Add-InstantClient
65-
if ($extension -eq "pdo_oci") {
66-
Enable-PhpExtension pdo_oci -Path $php_dir
67-
} else {
68-
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
69-
$oci8DLL = Get-Oci8DLL
70-
if($oci8DLL) {
71-
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
72-
} else {
73-
$status = 'Installed and enabled'
74-
Get-File -Url (Get-Oci8Url) -OutFile $php_dir\oci8.zip
75-
Expand-Archive -Path $php_dir\oci8.zip -DestinationPath $ext_dir -Force
76-
}
66+
if($version -lt '8.4') {
67+
if($version -lt '5.6' -and $extension -eq 'oci8') {
68+
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
69+
} else {
70+
Enable-PhpExtension $extension -Path $php_dir
7771
}
78-
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
72+
} else {
73+
$status = 'Installed and enabled'
74+
Add-Extension $extension >$null 2>&1
7975
}
80-
Add-Log $tick $extension $status
76+
Add-ExtensionLog $extension $status
8177
Add-LicenseLog
8278
} catch {
8379
Add-Log $cross $extension "Could not install $extension on PHP $( $installed.FullVersion )"

0 commit comments

Comments
 (0)