我已经通过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目录的路径。使用"instantclient,/path/to/instant/client/lib"(如果使用Oracle Instant Client[自动检测]:
我不确定这个/path/to/instant/client/lib
是什么,所以我运行了locate sqplus
:
/usr/local/Cellar/instantclient-sqlplus/usr/local/Cellar/instantclient-sqlplus/19.0.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.0.0.0.0dbru/INSTALL_RECEIPT.json/usr/local/Cellar/instantclient-sqlplus/19.0.0.0.0dbru/bin/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/bin/sqlplus/usr/local/Cellar/instantclient-sqlplus/19.0.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.0.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.0.0.0.0dbru/lib检查ORACLE_HOME库有效性。。。配置:错误:Oracle库在中找不到目录/usr/local/Cellar/instantclient-sqlplus/19.0.0.0.0dbru/lib错误:`/private/tmp/pear/temp/oci8/configure--使用php配置=/usr/local/opt/php/bin/php配置--使用-oci8=/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/lib'失败的
/usr/local/lib/
正在检查Oracle Instant Client目录/usr/local/lib/checkingOracle Instant Client SDK头目录。。。配置:错误:Oracle找不到Instant Client SDK头文件错误:`/private/tmp/pear/temp/oci8/configure--使用php配置=/usr/local/opt/php/bin/php配置--使用-oci8=instantclient,/usr/local/lib/'失败
/path/to/instant/client/lib产生了与前者相同的错误。
那么,正确的是什么?
就我个人而言,我会从Oracle安装新的Instant Client 19.8 DMG。下载页面和软件包包含说明。另请参阅公证macOS Oracle Instant Client Packages Make Installation Easyer中的步骤。安装Basic和SDK软件包,如果你也想要的话,还可以安装SQL*Plus。您在PECL提示符下给出的路径为/Users/yourname/Downloads/instinclient_19_8,但如果您想将该目录放在其他位置,则可以移动该目录。
可能是brew包将头文件放在了OCI8安装脚本不知道的地方。通过使用DMG,可以找到标题。