默认情况下,PHP 5.3似乎缺少Intl扩展 [英] PHP 5.3 seems to be missing Intl extension by default

查看:99
本文介绍了默认情况下,PHP 5.3似乎缺少Intl扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的系统是Ubuntu 12.04,PHP 5.3,并且我正在尝试运行一些基本的Intl代码,如下所示:

My system is Ubuntu 12.04, PHP 5.3, and I'm trying to run some basic Intl code like this:

<?php
$coll  = collator_create('en_US');
$result = collator_compare($coll, "string#1", "string#2");

它会输出

PHP Fatal error:  Call to undefined function collator_create()

从5.3版开始,国际扩展不是应该与PHP捆绑在一起吗?

Wasn't Intl extension supposed to be bundled with PHP since version 5.3?

PHP是通过apt-get使用以下命令行安装的(我不使用Apache):

PHP was installed via apt-get with this command line (I don't use Apache):

apt-get install php5 php5-cli php5-mysql php5-cgi php5-fpm php5-curl php-apc php5-memcache php5-memcached php5-common php5-gd php-xml-parser php-pear php5-imap php5-mcrypt php5-xdebug php5-suhosin

这是php -v产生的东西:

PHP 5.3.10-1ubuntu3.5 with Suhosin-Patch (cli) (built: Jan 18 2013 23:40:19) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
    with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

推荐答案

在安装时已指定--enable-intl以使用捆绑版的intl,也可以通过PECL进行安装.请参阅: http://www.php.net/manual/en/intl.installation.php

You have specify --enable-intl when installing to use the bundled version of intl, or you can install it via PECL. See: http://www.php.net/manual/en/intl.installation.php

apt-get install php5-intl也将起作用.

这篇关于默认情况下,PHP 5.3似乎缺少Intl扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆