简体   繁体   English

PHP 5.3似乎默认缺少Intl扩展

[英]PHP 5.3 seems to be missing Intl extension by default

My system is Ubuntu 12.04, PHP 5.3, and I'm trying to run some basic Intl code like this: 我的系统是Ubuntu 12.04,PHP 5.3,我正在尝试运行一些基本的Intl代码,如下所示:

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

and it outputs 它输出

PHP Fatal error:  Call to undefined function collator_create()

Wasn't Intl extension supposed to be bundled with PHP since version 5.3? 自5.3版以来,不应该将Intl扩展与PHP捆绑在一起吗?

PHP was installed via apt-get with this command line (I don't use Apache): 使用此命令行通过apt-get安装PHP(我不使用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

And here is what php -v produces: 这是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

You have specify --enable-intl when installing to use the bundled version of intl, or you can install it via PECL. 在安装时使用捆绑版本的intl指定了--enable-intl ,或者可以通过PECL安装它。 See: http://www.php.net/manual/en/intl.installation.php 请参阅: http//www.php.net/manual/en/intl.installation.php

apt-get install php5-intl will also work. apt-get install php5-intl也可以。

Add php5-intl to the list of things you install. php5-intl添加到您安装的内容列表中。

It looks like it's just not part of the core PHP5 release, even though it is an option to be included, similar to how php-apc is now a standard part of PHP, though you have to explicitly install it. 看起来它不是PHP5核心版本的一部分,即使它是一个包含的选项,类似于php-apc现在是PHP的标准部分,尽管你必须明确地安装它。

Try in php.ini uncomment extension intl "extension = php_intl.dll", should be removed ";" 试试php.ini uncomment extension intl“extension = php_intl.dll”,应该删除“;” before "extension", and then restart the server. 在“扩展”之前,然后重新启动服务器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM