且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

XAMPP 上的 PHP-intl 安装

更新时间:2023-02-23 16:58:18

以下这些步骤对我有帮助,以防万一您使用的是 OSX

These below steps helped me, Just in case if you are using OSX

来自 http://www.phpzce 的步骤.com/blog/view/15/installing-intl-package-on-your-mac-with-xampp

  1. 检查设置了哪个php路径,即

  1. Check which php path is set i.e.

root$: which php

  • 如果您在 Mac 上使用 xampp,它应该是

  • If you are using xampp on your mac it should be

    /Applications/XAMPP/xamppfiles/bin/php 
    

    但是如果它

    /usr/bin/php 
    

    您需要更改您的 OSx php

    you need to change your OSx php

    root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}" 
    

  • 安装icu4c

  • Install icu4c

    root$: brew install icu4c 
    

  • 通过 PECL 安装 Intl

  • Install Intl via PECL

    root$: sudo pecl update-channels 
    root$: sudo pecl install intl 
    

  • 您可以检查 Intl 是否安装成功

  • You can check if Intl was installed successfully

    root$: php -m | grep intl #should return 'intl' 
    

  • 完成

    ==============================

    ============================

    注意:

    • /Applications/XAMPP/xamppfiles/etc/php.ini 文件中的扩展列表添加/取消注释 extension=intl.so 行.并重新启动Apache.谢谢@pazhyn

    • From extensions list in /Applications/XAMPP/xamppfiles/etc/php.ini file Add / Uncomment extension=intl.so line. And restart Apache. Thanks @pazhyn

    在安装intl"之前,如果你还没有安装 Autoconf,你必须先安装它.谢谢@Digant

    Before installing "intl" you have to install Autoconf if you have not installed it. Thanks @Digant

    • 通过 Homebrew brew install autoconf automake或
    • 通过运行下面的命令

    • via Homebrew brew install autoconf automake or
    • by running below commands

    curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
    tar xzf autoconf-latest.tar.gz
    cd autoconf-*
    ./configure --prefix=/usr/local
    make
    sudo make install
    cd ..
    rm -r autoconf-*