安装

This extension may be installed using the bundled version as of PHP 5.3.0, or as a PECL extension as of PHP 5.2.0. In other words, there are two methods to install the intl extension.

安装此 PECL 扩展相关的信息可在手册中标题为 PECL 扩展的安装章节中找到。更多信息如新的发行版本、下载、源文件、 维护人员信息及变更日志等,都在此处: » https://pecl.php.net/package/intl.

Alternatively, --enable-intl will enable the bundled version while compiling PHP.

If your ICU is installed to a non-standard directory then you might want to specify its location in LD_LIBRARY_PATH environment variable so that dynamic linker can find it:

$ export LD_LIBRARY_PATH=/opt/icu/lib

Otherwise, if PHP and ICU are installed to their default locations, then the additional options to `configure' are not needed.

User Contributed Notes

lee dot wp14 at gmail dot com 28-Dec-2020 01:06
For ubuntu: apt install php-intl
Anonymous 18-Jun-2018 07:28
For windows I had to uncomment extension=intl in the php.ini
hello at scottgruber dot me 17-Jun-2016 06:29
For php7 on Ubuntu

sudo apt-get install php7.0-intl
ahmedelnaa2010 at gmail dot com 30-Mar-2016 01:00
- open your php.ini file    c:/xampp/php/php.ini or search how to find it, it's up to your server.
- find for ;extension=php_intl.dll
- remove the comment ;
- restart the apache
- then it's working :)

i used the same when i have problem in any extensions, open php.ini then search for the extension then remove the comment.
daniel at danielphenry dot com 29-Apr-2015 04:50
To install on windows uncommenting the dll in php.ini is not enough you also need to include several other libraries in your system path (not user path). Found these details here: http://stackoverflow.com/a/6086991/819883
nirbhabbarat at gmail dot com 09-Apr-2015 05:23
OS : CentOS 5.10
PHP : 5.5.12
We tried installing via *pecl install intl* , but we were getting below warning in php error logs

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20121212/intl.so' - /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /usr/local/lib/libicuio.so.55) in Unknown on line 0

Later we tried icu source from http://site.icu-project.org/download
Compile ICU ./configure --prefix=/opt/icu && make && make install

And post which we compiled PHP via source with following configurations:
  --enable-intl
  --with-icu-dir=/opt/icu
jonwebb at tecbiz dot eu 29-Apr-2014 02:41
On windows servers, open your php.ini (which should be in Program Files/PHP), and simply uncomment the extension.
extension=php_intl.dll
Restart IIS Webserver - done.
jltupac at hotmail dot com 17-May-2013 05:03
Ubuntu:
sudo apt-get install php5-intl
Epaphus 05-Mar-2013 10:39
You need to install the library.

yum install libicu-devel

Will get it working with "pecl install intl"
spectrumcat 12-Feb-2013 10:45
On Fedora 18 "pecl install intl" wasn't working after "yum -y install icu" so I had to run "yum -y install php-intl" instead
xgretsch 04-Apr-2011 03:46
I'm running on Mac OS X using a MacPorts install. According to this page, my vanilla version of PHP 5.3.5 from MacPorts should include the intl functions by default. As far as I can see from phpinfo(), the MacPorts version did not disable it. However, the functions aren't visible and don't work.

It seems to require an additional:

sudo port install php5-intl

After which everything bursts into life.
PHP8中文手册 站长在线 整理 版权归PHP文档组所有