Skip to content

Commit

Permalink
Fix oci extension support on Windows for PHP 8.4 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Dec 26, 2024
1 parent 96fb539 commit 6e0d7cb
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/scripts/extensions/oci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Function Get-Oci8DLL() {
return $_
}
}
return $null
}

# Function to install oci8 and pdo_oci.
Expand All @@ -63,18 +64,20 @@ Function Add-Oci() {
$status = 'Enabled'
Add-InstantClient
if ($extension -eq "pdo_oci") {
Enable-PhpExtension pdo_oci -Path $php_dir
if($version -lt '8.4') {
Enable-PhpExtension pdo_oci -Path $php_dir
} else {
Add-Extension pdo_oci >$null 2>&1
}
} else {
if(-not(Test-Path $ext_dir\php_oci8.dll)) {
$oci8DLL = Get-Oci8DLL
if($null -eq $oci8DLL -or $version -ge '8.4') {
$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
$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
}
}
Copy-Item -Path $oci8DLL -Destination $ext_dir\php_oci8.dll
Add-Content -Value "`r`nextension=php_oci8.dll" -Path $php_dir\php.ini
}
Add-Log $tick $extension $status
Expand Down

0 comments on commit 6e0d7cb

Please sign in to comment.