http.so 一个容错问题,编译安装成功,但是执行的时候抛出
php: symbol lookup error: /usr/local/php/lib/php/extensions/no-debug-non-zts-20190902/http.so: undefined symbol: uidna_IDNToASCII
php版本 7.4.28
pecl_http 版本 3.2.3
在pecl_http源代码找 uidna_IDNToASCII 定义,发现如下代码:
AC_PATH_PROG(ICU_CONFIG, icu-config, false, [$PHP_HTTP_LIBICU_DIR/bin:$PATH:/usr/local/bin])
if $ICU_CONFIG --exists >/dev/null 2>/dev/null; then
PECL_CHECK_CONFIG(libicu, [$ICU_CONFIG], [--version], [--cppflags], [--ldflags-searchpath], [--ldflags-libsonly])
else
PECL_CHECK_PKGCONFIG(icu-i18n, [$PHP_HTTP_LIBICU_DIR])
fi
AC_CACHE_CHECK([for uidna_IDNToASCII], PECL_CACHE_VAR([HAVE_UIDNA_IDNToASCII]), [
if printf "%s" "$CFLAGS" | $EGREP -q "(^|\s)-Werror\b"; then
if ! printf "%s" "$CFLAGS" | $EGREP -q "(^|\s)-Wno-error=deprecated-declarations\b"; then
CFLAGS="$CFLAGS -Wno-error=deprecated-declarations"
fi
fi
AC_TRY_LINK([
#include <unicode/uidna.h>
], [
uidna_IDNToASCII(0, 0, 0, 0, 0, 0, 0);
], [
PECL_CACHE_VAR([HAVE_UIDNA_IDNToASCII])=yes
], [
PECL_CACHE_VAR([HAVE_UIDNA_IDNToASCII])=no
])
])
看来是依赖 libicu 或者 icu-i18n ,都没有再自己定义
于是安装 libicu libicu-dev 问题解决。