一尘不染

在XAMPP上安装php-intl

php

我需要在XAMPP的Mac上使用扩展名intl。

因此,我遵循了以下链接:

XAMPP for Mac Lion 10.8上的php-
intl安装

http://lvarayut.blogspot.it/2013/09/installing-intl-extension-in-
xampp.html

我总是重新启动我的apache服务器,但是没有安装扩展名。因为如果我启动:

php -m | grep intl #should return 'intl'

返回空

没有它,我无法启动的命令是针对composer和cakephp的,如下所示:

composer create-project --prefer-dist -s dev cakephp/app cakephp3

返回此错误:

Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for cakephp/cakephp 3.0.*-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
    - cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
  Problem 2
    - cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - cakephp/bake dev-master requires cakephp/cakephp 3.0.x-dev -> satisfiable by cakephp/cakephp[3.0.x-dev].
    - Installation request for cakephp/bake dev-master -> satisfiable by cakephp/bake[dev-master].

所以我需要用扩展名intl解决ext-intl的问题。

有人可以帮我解决这个问题吗?如何安装此扩展程序?

谢谢


阅读 513

收藏
2020-05-26

共1个答案

一尘不染

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

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

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

    root$: which php
    
  2. 如果您在Mac上使用xampp,则应该

    /Applications/XAMPP/xamppfiles/bin/php
    

但是如果它

    /usr/bin/php

您需要更改您的OSx PHP

    root$: PATH="/Applications/XAMPP/xamppfiles/bin:${PATH}"
  1. 安装icu4c

    root$: brew install icu4c
    
  2. 通过PECL安装国际

    root$: sudo pecl update-channels
    

    root$: sudo pecl install intl

  3. 您可以检查Intl是否已成功安装

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

完成了

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

注意:

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

  • 在安装“ intl”之前,如果尚未安装Autoconf,则必须先安装它。谢谢@Digant

    • 通过Homebrew brew安装autoconf automake或
    • 通过运行以下命令
          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-

2020-05-26