Intl扩展没有加载

时间:2015-11-24 05:33:11

标签: php

我按照 answer 上的说明安装了intl.so扩展程序。但它没有被装载。 当我在终端中运行php -r "print_r(get_loaded_extensions());";命令时,我得到了

Array
(
    [0] => Core
    [1] => date
    [2] => ereg
    [3] => libxml
    [4] => openssl
    [5] => pcre
    [6] => sqlite3
    [7] => zlib
    [8] => bcmath
    [9] => bz2
    [10] => calendar
    [11] => ctype
    [12] => curl
    [13] => dba
    [14] => dom
    [15] => hash
    [16] => fileinfo
    [17] => filter
    [18] => ftp
    [19] => gd
    [20] => gettext
    [21] => SPL
    [22] => iconv
    [23] => json
    [24] => ldap
    [25] => mbstring
    [26] => session
    [27] => standard
    [28] => mysqlnd
    [29] => odbc
    [30] => pcntl
    [31] => mysqli
    [32] => PDO
    [33] => pdo_mysql
    [34] => PDO_ODBC
    [35] => pdo_sqlite
    [36] => Phar
    [37] => posix
    [38] => readline
    [39] => Reflection
    [40] => mysql
    [41] => shmop
    [42] => SimpleXML
    [43] => soap
    [44] => sockets
    [45] => exif
    [46] => sysvmsg
    [47] => sysvsem
    [48] => sysvshm
    [49] => tokenizer
    [50] => wddx
    [51] => xml
    [52] => xmlreader
    [53] => xmlrpc
    [54] => xmlwriter
    [55] => xsl
    [56] => zip
    [57] => intl
    [58] => phalcon
    [59] => mhash
)

第57位是intl 但是当我在我的项目中打印它时

print_r(get_loaded_extensions());
die;

我得到了以下数组

Array
(
    [0] => Core
    [1] => date
    [2] => ereg
    [3] => libxml
    [4] => openssl
    [5] => pcre
    [6] => sqlite3
    [7] => zlib
    [8] => bcmath
    [9] => bz2
    [10] => calendar
    [11] => ctype
    [12] => curl
    [13] => dba
    [14] => dom
    [15] => hash
    [16] => fileinfo
    [17] => filter
    [18] => ftp
    [19] => gd
    [20] => gettext
    [21] => SPL
    [22] => iconv
    [23] => session
    [24] => json
    [25] => ldap
    [26] => mbstring
    [27] => mcrypt
    [28] => standard
    [29] => mysqlnd
    [30] => mysqli
    [31] => mysql
    [32] => PDO
    [33] => pdo_mysql
    [34] => pdo_pgsql
    [35] => pdo_sqlite
    [36] => Phar
    [37] => posix
    [38] => Reflection
    [39] => imap
    [40] => shmop
    [41] => SimpleXML
    [42] => soap
    [43] => sockets
    [44] => exif
    [45] => sybase_ct
    [46] => sysvsem
    [47] => sysvshm
    [48] => tokenizer
    [49] => wddx
    [50] => xml
    [51] => xmlreader
    [52] => xmlrpc
    [53] => xmlwriter
    [54] => xsl
    [55] => zip
    [56] => apache2handler
    [57] => phalcon
    [58] => mhash
)
这里缺少

intl

做什么。我错过了什么。

我在php.ini

中这样做了
extension="/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so"

extension="intl.so"

并重新启动服务器。

1 个答案:

答案 0 :(得分:2)

查找终端的加载配置

运行以下命令并找到加载的配置文件。然后将扩展行添加到该配置文件中。

$ php --ini

示例输出

Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File:         /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed:      /etc/php5/cli/conf.d/05-opcache.ini

将扩展添加到配置文件

extension="/Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20131226/intl.so"

查找已加载的网络配置

如果您不知道从Web服务器加载的php.ini。

将以下代码添加到php文件并访问该URL。您可以在输出中找到Loaded配置文件。将Extension添加到该配置文件并重新启动webserver。

// info.php的

<?php phpinfo(); ?>