如何在macOS Catalina或Big Sur上的PHP 7.4上安装OCI8扩展? [英] How to install OCI8 extension on PHP 7.4 on macOS Catalina or Big Sur?

查看:245
本文介绍了如何在macOS Catalina或Big Sur上的PHP 7.4上安装OCI8扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经通过Homebrew在Mac上安装了PHP 7.4.11和Apache 2.4.46.

I already have PHP 7.4.11 and Apache 2.4.46 installed on my Mac via Homebrew.

然后安装了Oracle Instant Client&sqlplus(v19.3.0.0.0):

Then installed Oracle instant client & sqlplus (v19.3.0.0.0):

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

下一步是通过运行以下命令来安装OCI8扩展:

Next is to install the OCI8 extension, by running:

pecl install oci8

PECL提示了我

请提供ORACLE_HOME目录的路径.用'instantclient,/path/to/instant/client/lib',如果您使用Oracle Instant Client [自动检测]:

Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] :

我不确定这是什么/path/to/instant/client/lib ,所以我运行了 locate sqplus :

I was not sure what is this /path/to/instant/client/lib, so I ran locate sqplus:

/usr/local/Cellar/instantclient-sqlplus/usr/local/地窖/instantclient-sqlplus/19.3.0.0.0dbru/usr/local/Cellar/instantclient-sqlplus/19.3.0.0.0dbru/.brew/usr/local/地窖/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/地窖/instantclient-sqlplus/19.3.0.0.0dbru/bin/usr/local/地窖/instantclient-sqlplus/19.3.0.0.0dbru/bin/sqlplus/usr/local/地窖/instantclient-sqlplus/19.3.0.0.0dbru/lib/usr/local/地窖/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/地窖/instantclient-sqlplus/19.3.0.0.0dbru/libexec/usr/local/地窖/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 /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

好的,让我们尝试这两个目录:

OK, let's try these 2 directories:

/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库有效性...配置:错误:Oracle库找不到目录/usr/local/Cellar/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 =即时客户端,/usr/local/lib/'失败

checking Oracle Instant Client directory... /usr/local/lib/ checking Oracle Instant Client SDK header directory... configure: error: Oracle Instant Client SDK header files not found ERROR: `/private/tmp/pear/temp/oci8/configure --with-php-config=/usr/local/opt/php/bin/php-config --with-oci8=instantclient,/usr/local/lib/' failed

/path/to/instant/client/lib 产生了与前一个相同的错误.

/path/to/instant/client/lib produced the same error like the former.

那么正确的是什么?

推荐答案

我个人将安装新的经过公证的macOS Oracle中的步骤即时客户端软件包使安装更容易.安装 Basic 和 SDK 包 - 如果您也需要,也可以安装 SQL*Plus.在PECL提示符下输入的路径将是/Users/yourname/Downloads/instanclient_19_8,但如果要将目录放置在其他位置,则可以将其移动.

Personally I'd install the new Instant Client 19.8 DMGs from Oracle. The download page and the packages contain instructions. Also see the steps at Notarized macOS Oracle Instant Client Packages Make Installation Easier. Install the Basic and SDK packages - and maybe SQL*Plus if you want that too. The path you would give at the PECL prompt will be /Users/yourname/Downloads/instanclient_19_8 but you can move that directory if you want to put it somewhere else.

可能是brew软件包将头文件放在OCI8安装脚本不知道的位置.通过使用DMG,可以找到标题.

It could be that the brew packages are putting the header files in a place that the OCI8 install script isn't aware. By using the DMGs, the headers will be found.

这篇关于如何在macOS Catalina或Big Sur上的PHP 7.4上安装OCI8扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆