【问题标题】:Trying to install int extension macOS Catalina and PHP 7.4.10尝试安装 int 扩展 macOS Catalina 和 PHP 7.4.10
【发布时间】:2020-12-28 04:10:45
【问题描述】:

我正在尝试为PHP 7.4.10 安装zipintl 扩展

我跑

sudo pecl install intl

然后安装请求:

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

然后我按回车并继续,但随后显示下一个错误:

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

我也检查了很多指南以通过 php.ini 添加 extension=zip 安装 zip 扩展但不工作

任何帮助将不胜感激

[更新]我尝试使用第一个答案,我在运行所有后得到,最后一个命令输出是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

【问题讨论】:

标签: php zip config intl


【解决方案1】:

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

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

【讨论】:

    【解决方案2】:

    您的系统上是否存在 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-02-08
      • 2021-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多