2015-01-11 454 views
9

我需要在XAMPP的Mac上使用擴展intl。XAMPP上的Php-intl安裝

所以我跟着這個鏈接:

Php-intl installation on XAMPP for Mac Lion 10.8

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

我重新啓動一直是我的Apache服務器,但沒有安裝該擴展。因爲如果我啓動:

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

返回空

,我不能沒有發動它是作曲家和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的問題。

有人可以幫我解決這個問題嗎? 如何安裝此擴展?

感謝

+0

要MAMP HTTP設置路徑://計算器。 com/questions/4145667 /如何覆蓋-php-to-use-the-mamp-path的路徑,它也是自動的 –

回答

26

這些下面的步驟幫助我,以防萬一,如果您使用的是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}" 
    
  3. 安裝ICU4C

    root$: brew install icu4c 
    
  4. 通過PECL

    root$: sudo pecl update-channels 
    root$: sudo pecl install intl 
    
  5. 安裝國際機場
  6. 您可以檢查是否國際機場成功

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

安裝完成

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

注:

  • 從擴展名列表中/Applications/XAMPP/xamppfiles/etc/php.ini文件添加/取消註釋extension=intl.so一行。並重新啓動Apache。謝謝@pazhyn

  • 在安裝「intl」之前,您必須安裝Autoconf(如果尚未安裝它)。感謝@Digant

    • 經由Homebrew釀造通過運行下面的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-* 
      
+0

令人驚訝的是,它的工作正常,但一些步驟有詳細的內容,如安裝PECL和icu4c –

+0

得到'沒有可用於包的版本'pecl.php.net/intl'' – nullwriter

+0

當我運行這個命令sudo pecl install intl it返回此信息沒有發佈包可用於「pecl.php.net/intl」 安裝失敗@Belalmazlom –

10

我使用的Moodle,這是我固定做時,曾與國際問題如下:

  1. 重新運行XAMPP安裝程序(if you don't have the installer on hand, download it from here),並勾選「XAMPP開發文件」 XAMPP installer
  2. 使用終端,進入XAMPP的二進制文件夾$ cd /Applications/XAMPP/bin
  3. 使用PHP的包管理器運行安裝這應該編一些東西,如果成功的話,安裝應完成:

    Build process completed successfully 
    Installing '/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so' 
    install ok: channel://pecl.php.net/intl-3.0.0 
    configuration option "php_ini" is not set to php.ini location 
    You should add "extension=intl.so" to php.ini 
    
  4. $ cd ../etc在那裏,你將有你的php.ini到你必須添加extension=intl.so在我的系統附加線959後線,您可以通過搜索找到php_intl
  5. 最後從XAMPP GUI重新啓動Apache Web服務器。

希望這適合你!

+0

這要求,應該安裝icu librarie – user1767754

+0

當我運行這個命令時sudo ./pecl install intl它返回這個msg沒有可用的軟件包「pecl.php.net/intl」安裝失敗 –

+0

這工作就像一個魅力爲了我。謝謝。 –

3

我和XAMPP有同樣的問題。 我嘗試了幾個答案,但沒有成功。 可以解決降低替代庫http://php-osx.liip.ch/。 這個庫的php,已經安裝了intl和其他幾個包。 下載後到xampp的httpd.conf中,LoadModule php5_module指向/ usr/local/php5/libphp5中的這些包。所以

+0

可能是一個解決方案,我會盡快嘗試,謝謝 –

+0

我剛試過這個 - 它的工作!謝謝!我還必須將/ usr/local/php5/bin添加到PATH變量的前面。一旦我完成了這一切,似乎一切都好了。我一直在嘗試各種各樣的東西2天,而這似乎已經爲我破解! – Sharon