簡體   English   中英

如何在 macOS Catalina 或 Big Sur 上的 PHP 7.4 上安裝 OCI8 擴展?

[英]How to install OCI8 extension on PHP 7.4 on macOS Catalina or Big Sur?

我已經通過 Homebrew 在我的 Mac 上安裝了 PHP 7.4.11 和 Apache 2.4.46。

然后安裝了 Oracle 即時客戶端 & sqlplus (v19.3.0.0.0):

$ brew tap InstantClientTap/instantclient
$ brew install instantclient-basic
$ brew install instantclient-sqlplus

接下來是安裝 OCI8 擴展,運行:

pecl install oci8

PECL 提示我:

請提供 ORACLE_HOME 目錄的路徑。 如果您使用 Oracle Instant Client [autodetect] 進行編譯,請使用 'instantclient,/path/to/instant/client/lib' :

我不確定這是什么/path/to/instant/client/lib ,所以我運行locate sqplus

/usr/local/Cellar/instantclient-sqlplus /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/.brew /usr/local/ Cellar/instantclient-sqlplus/19.3.0.0.0dbru/.brew/instantclient-sqlplus.rb /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/INSTALL_RECEIPT.json /usr/local/Cellar/instantclient-sqlplus /19.3.0.0.0dbru/bin /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/bin/sqlplus /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib /usr/local /Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib/libsqlplus.dylib /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib/libsqlplusic.dylib /usr/local/Cellar/instantclient-sqlplus /19.3.0.0.0dbru/libexec /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/libexec/sqlplus /usr/local/Homebrew/Library/Taps/instantclienttap/homebrew-instantclient/Formula/instantclient-sqlplus .rb /usr/local/bin/sqlplus /usr/local/lib/libsqlplus.dylib /usr/local/lib/libsqlplusic.dylib /usr/local/opt /instantclient-sqlplus /usr/local/var/homebrew/linked/instantclient-sqlplus

好的,讓我們試試這兩個目錄:

/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib

檢查 Oracle ORACLE_HOME 安裝目錄... /usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib 檢查 ORACLE_HOME 庫有效性...配置:錯誤:在 /usr/local/Cellar/ 中找不到 Oracle 庫目錄Instantclient-sqlplus/19.3.0.0.0dbru/lib 錯誤:`/private/tmp/pear/temp/oci8/configure --with-php-config=/usr/local/opt/php/bin/php-config -- with-oci8=/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib' 失敗

/usr/local/lib/

檢查 Oracle Instant Client 目錄... /usr/local/lib/ 檢查 Oracle Instant Client SDK 頭目錄...配置:錯誤:未找到 Oracle Instant Client SDK 頭文件 錯誤:`/private/tmp/pear/temp/oci8 /configure --with-php-config=/usr/local/opt/php/bin/php-config --with-oci8=instantclient,/usr/local/lib/' 失敗

/path/to/instant/client/lib產生與前者相同的錯誤。

那什么是正確的呢?

我個人會從 Oracle安裝新的Instant Client 19.8 DMG 下載頁面和軟件包包含說明。 另請參閱Notarized macOS Oracle Instant Client Packages Make Installation Easer 中的步驟。 安裝 Basic 和 SDK 包 - 如果您也需要,也可以安裝 SQL*Plus。 您在 PECL 提示符下提供的路徑將是 /Users/yourname/Downloads/instanclient_19_8 但如果您想將它放在其他地方,您可以移動該目錄。

可能是 brew 包將頭文件放在 OCI8 安裝腳本不知道的地方。 通過使用 DMG,將找到標題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM