尝试安装int扩展程序macOS Catalina和PHP 7.4.10

问题描述

我正在尝试为zip安装intlPHP 7.4.10扩展名

我跑步

sudo pecl install intl

然后安装请求:

Specify where ICU libraries and headers can be found [DEFAULT] : 

然后我按Enter键并继续,但随后显示一个错误

configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

然后我开始看看如何安装icu,然后运行:

brew install icu4c

控制台显示

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> /Users/user/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> /Users/user/.bash_profile

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
  export .bash_profile="/usr/local/opt/icu4c/lib/pkgconfig"

我将所有路径添加.bash_profile配置文件中并运行:

source .bash_profile

在这一点上,我不确定我仍会收到做什么:

== Environment ==
!! PHP_extension zip !!
[System] must be installed and enabled - The Zip PHP extension is Now required by Moodle,info-ZIP binaries or
PclZip library are not used anymore.


!! PHP_extension intl !!
[System] must be installed and enabled - Intl extension is required to improve internationalization support,such as
locale aware sorting and international domain names.

即使在运行sudo apachectl restart

之后

我也查看了很多指南,以通过zip添加PHP.ini来安装extension=zip扩展名,但没有用

任何帮助将不胜感激

[UPDATE]我尝试用拳头答案回答问题,我全部运行完毕后得到的最后一个命令输出sudo pecl update-channels && sudo pecl install intl

checking for icu-uc >= 50.1 icu-io icu-i18n... no
configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

Consider adjusting the PKG_CONfig_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively,you may set the environment variables ICU_CFLAGS
and ICU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
ERROR: `/private/tmp/pear/temp/intl/configure --with-PHP-config=/usr/local/opt/PHP/bin/PHP-config --with-icu-dir=/usr/local/opt/icu4c' Failed

解决方法

当 icu4c 与 brew 一起安装时,它不会将其文件复制到 pkg-config 配置目录。 因此,另一种解决方法是将 PKG_CONFIG_PATH 设置为 lib 所在的文件夹。示例:

PKG_CONFIG_PATH=/usr/local/Cellar/icu4c/69.1/lib/pkgconfig/ pkg-config --cflags --libs libsoup-2.4
,

您的系统上是否存在icu4c?

的输出是什么?
which icu4c

如果您没有输出,我们可以进一步调查。快速浏览ICU documentation会告诉我们该库依赖于autoconf。

brew update

brew install autoconf automake libtool

brew install icu4c

现在让我们检查icu4c是否已正确安装

which icu4c

如果此时您仍然没有输出,那么最好从源代码安装和编译icu4c。因为通过Homebrew安装的该库可能会遭受from multiple issues的困扰。

wget https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz

tar xvfz icu4c-67_1-src.tgz

cd icu/source

./configure --prefix=/usr/local/opt/icu4c/67_1 --enable-icu-config
sudo make && sudo make install

之后您可以继续

sudo pecl update-channels && sudo pecl install intl

如果会询问您

指定可以在哪里找到ICU库和标头[DEFAULT]:

答案是

/usr/local/opt/icu4c

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...