在 mac XAMPP PHP 7.4.20 上安装 OCI8 失败,并显示无法检测 PHP 版本

问题描述 投票:0回答:1

我尝试在 Mac OS monterey 上的 XAMPP php 7.4.20 上安装 oci8,但我不断收到此错误“配置:错误:无法检测 PHP 版本,请报告”

我尝试使用以下过程进行设置

https://blogs.oracle.com/opal/post/installing-xampp-on-macos-for-php-and-oracle-database

以下是我的错误日志

我尝试过使用 php 8.1.6 安装 XAMPP,当我尝试安装时出现相同的错误。

我使用 pecl 安装了不同的扩展,它是成功的,但不知何故 oci8 扩展一直失败

我已经在 .zshrc 中配置了我的 php,并且在运行时能够获得正确的 php 路径

which php
当我运行
php --version
时,我也得到了正确的 php 版本,如错误日志中最后一个命令所示

可能是什么问题。

sudo pecl install oci8-2.2.0
Password:
downloading oci8-2.2.0.tgz ...
Starting to download oci8-2.2.0.tgz (196,449 bytes)
.........................................done: 196,449 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version:         20190902
Zend Module Api No:      20190902
Zend Extension Api No:   320190902
configure.ac:18: warning: $as_echo is obsolete; use AS_ECHO(["message"]) instead
build/php.m4:2162: PHP_CONFIG_NICE is expanded from...
configure.ac:18: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
build/libtool.m4:2800: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2726: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
lib/m4sugar/m4sh.m4:697: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:704: AS_IF is expanded from...
./lib/autoconf/general.m4:2264: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2277: AC_CACHE_CHECK is expanded from...
build/libtool.m4:718: _LT_AC_LOCK is expanded from...
build/libtool.m4:1205: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2800: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2726: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/general.m4:2921: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:697: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:704: AS_IF is expanded from...
./lib/autoconf/general.m4:2264: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2277: AC_CACHE_CHECK is expanded from...
build/libtool.m4:718: _LT_AC_LOCK is expanded from...
build/libtool.m4:1205: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2800: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2726: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1205: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2800: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2726: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1205: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:2800: _LT_AC_LANG_C_CONFIG is expanded from...
build/libtool.m4:2726: AC_LIBTOOL_LANG_C_CONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not exist
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not exist
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: output file \`$ofile' does not look like a libtool script
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: output file \`$ofile' does not look like a libtool script
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: tag name \"$tagname\" already exists
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: The macro `AC_LANG_CPLUSPLUS' is obsolete.
configure.ac:161: You should run autoupdate.
./lib/autoconf/c.m4:262: AC_LANG_CPLUSPLUS is expanded from...
build/libtool.m4:3808: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2808: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1205: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:3808: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2808: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
configure.ac:161: warning: back quotes and double quotes must not be escaped in: $as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe
build/libtool.m4:1205: AC_LIBTOOL_SYS_HARD_LINK_LOCKS is expanded from...
build/libtool.m4:3808: _LT_AC_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:2808: AC_LIBTOOL_LANG_CXX_CONFIG is expanded from...
build/libtool.m4:1997: _LT_AC_TAGCONFIG is expanded from...
build/libtool.m4:209: AC_LIBTOOL_SETUP is expanded from...
build/libtool.m4:65: _AC_PROG_LIBTOOL is expanded from...
build/libtool.m4:47: AC_PROG_LIBTOOL is expanded from...
configure.ac:161: the top level
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] : instantclient,/Applications/XAMPP/xamppfiles/lib/oracle/instantclient_19_8
building in /private/tmp/pear/install/pear-build-rootrfgnIr/oci8-2.2.0
running: /private/tmp/pear/install/oci8/configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config --with-oci8=instantclient,/Applications/XAMPP/xamamppfiles/lib/oracle/instantclient_19_8
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for pkg-config... /Applications/XAMPP/xamppfiles/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether cc accepts -g... yes
checking for cc option to enable C11 features... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-apple-darwin21.5.0
checking host system type... x86_64-apple-darwin21.5.0
checking target system type... x86_64-apple-darwin21.5.0
checking for PHP prefix... /Applications/XAMPP/xamppfiles
checking for PHP includes... -I/Applications/XAMPP/xamppfiles/include/php -I/Applications/XAMPP/xamppfiles/include/php/main -I/Applications/XAMPP/xamppfiles/include/php/TSRM -I/Applications/XAMPP/xamppfiles/include/php/Zend -I/Applications/XAMPP/xamppfiles/include/php/ext -I/Applications/XAMPP/xamppfiles/include/php/ext/date/lib
checking for PHP extension directory... /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20190902
checking for PHP installed headers prefix... /Applications/XAMPP/xamppfiles/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking if awk is broken... no
checking for Oracle Database OCI8 support... yes, shared
checking PHP version... Unknown option: n
Usage: head [-options] <url>...
    -m <method>   use method for the request (default is 'HEAD')
    -f            make request even if head believes method is illegal
    -b <base>     Use the specified URL as base
    -t <timeout>  Set timeout value
    -i <time>     Set the If-Modified-Since header on the request
    -c <conttype> use this content-type for POST, PUT, CHECKIN
    -a            Use text mode for content I/O
    -p <proxyurl> use this as a proxy
    -P            don't load proxy settings from environment
    -H <header>   send this HTTP header (you can specify several)

    -u            Display method and URL before any response
    -U            Display request headers (implies -u)
    -s            Display response status code
    -S            Display response status chain
    -e            Display response headers
    -d            Do not display content
    -o <format>   Process HTML content in various ways

    -v            Show program version
    -h            Print this message

    -x            Extra debugging output
configure: error: failed to detect PHP version, please report
ERROR: `/private/tmp/pear/install/oci8/configure --with-php-config=/Applications/XAMPP/xamppfiles/bin/php-config --with-oci8=instantclient,/Applications/XAMPP/xamamppfiles/lib/oracle/instantclient_19_8' failed
mac@macs-MacBook-Pro instantclient-basiclite-macos.x64-19.8.0.0.0dbru % php --version
PHP 7.4.20 (cli) (built: Jun  7 2021 04:37:42) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
mac@macs-MacBook-Pro instantclient-basiclite-macos.x64-19.8.0.0.0dbru % php --version
php macos apache oci8
1个回答
0
投票

发生这种情况是因为 XAMPP 附带了一个名为

HEAD
的工具(
libwww-perl
的一部分),安装在
pecl
二进制文件旁边,位于
/Applications/XAMPP/xamppfiles/bin/HEAD
。尽管此目录不在
PATH
中,但 PECL 或构建脚本似乎添加了它。由于 macOS 的文件系统默认不区分大小写,这会导致构建脚本尝试使用
head
实用程序来执行这个完全不相关但名称相同的实用程序,从而导致它失败。

解决方法是将有问题的文件移开:

sudo mv /Applications/XAMPP/xamppfiles/bin/HEAD /Applications/XAMPP/xamppfiles/bin/HEAD.bak

此后,安装应该成功完成。

我不确定这个文件是否对任何事情都很重要,但是您可以在成功安装

oci8
模块后将其移回原位:

sudo mv /Applications/XAMPP/xamppfiles/bin/HEAD.bak /Applications/XAMPP/xamppfiles/bin/HEAD
© www.soinside.com 2019 - 2024. All rights reserved.