我设法在机器上启用了intl模块(这很棘手),当我执行php -m | grep intl
时,我看到了列出的模块。我的问题是,似乎该模块已启用,但是XAMPP可能仍在加载其他版本的PHP。
which php
的输出是:
/usr/local/opt/php@7.1/bin/php
php -v
的输出是:
PHP 7.1.26(CLI)(建立于2019年2月26日10:26:24)(NTS)版权所有(c) 1997-2018,PHP Group Zend Engine v3.1.0,版权所有(c)1998-2018 Zend Technologies Zend OPcache v7.1.26,版权所有(c)1999-2018,由Zend Technologies提供
php -i | grep intl
的输出是:
配置命令=>'./configure' '--prefix=/usr/local/Cellar/php@7.1/7.1.26' '--localstatedir = / usr / local / var''--sysconfdir = / usr / local / etc / php / 7.1' '--with-config-file-path = / usr / local / etc / php / 7.1' '--with-config-file-scan-dir = / usr / local / etc / php / 7.1 / conf.d' '--with-pear = / usr / local / Cellar / php @ 7.1 / 7.1.26 / share / php @ 7.1 / pear' '--enable-bcmath''--enable-calendar''--enable-dba''--enable-dtrace' '--enable-exif''--enable-ftp''--enable-fpm''--enable-intl' '--enable-mbregex''--enable-mbstring''--enable-mysqlnd' '--enable-opcache-file''--enable-pcntl''--enable-phpdbg' '--enable-phpdbg-webhelper''--enable-shmop''--enable-soap' '--enable-sockets''--enable-sysvmsg''--enable-sysvsem' '--enable-sysvshm''--enable-wddx''--enable-zip' '--with-apxs2 = / usr / local / opt / httpd / bin / apxs' '--with-bz2 = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' '--with-curl = / usr / local / opt / curl-openssl''--with-fpm-user = _www' '--with-fpm-group = _www''--with-freetype-dir = / usr / local / opt / freetype' '--with-gd''--with-gettext = / usr / local / opt / gettext' '--with-gmp = / usr / local / opt / gmp' '--with-iconv = /应用程序/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr' '--with-icu-dir = / usr / local / opt / icu4c' '--with-jpeg-dir = / usr / local / opt / jpeg' '--with-kerberos = /应用程序/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr' '--with-layout = GNU''--with-ldap = / usr / local / opt / openldap' '--with-ldap-sasl = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' '--with-libedit = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' '--with-libxml-dir = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' '--with-libzip''--with-mcrypt = / usr / local / opt / mcrypt' '--with-mhash = /应用程序/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr' '--with-mysql-sock = / tmp / mysql.sock''--with-mysqli = mysqlnd' '--with-ndbm = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' '--with-openssl = / usr / local / opt / openssl' '--with-pdo-dblib = / usr / local / opt / freetds''--with-pdo-mysql = mysqlnd' '--with-pdo-odbc = unixODBC,/ usr / local / opt / unixodbc' '--with-pdo-pgsql = / usr / local / opt / libpq' '--with-pdo-sqlite = / usr / local / opt / sqlite' '--with-pgsql = / usr / local / opt / libpq''--with-pic' '--with-png-dir = / usr / local / opt / libpng' '--with-pspell = / usr / local / opt / aspell' '--with-sqlite3 = / usr / local / opt / sqlite' '--with-tidy = / usr / local / opt / tidy-html5' '--with-unixODBC = / usr / local / opt / unixodbc' '--with-webp-dir = / usr / local / opt / webp''--with-xmlrpc' '--with-xsl = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' '--with-zlib = / Applications / Xcode.app / Contents / Developer / Platforms / MacOSX.platform / Developer / SDKs / MacOSX10.14.sdk / usr' intl intl.default_locale =>无值=>无值intl.error_level => 0 => 0国际使用异常=> 0 => 0
这些是我的bash个人资料中的路径:
export PATH =“ / usr/local/opt/php@7.1/bin:$ PATH”导出 PATH =“ / usr/local/opt/php@7.1/sbin:$ PATH”
然后,在php.ini
中,我未对此行添加注释:
extension = intl.so
xdebug
也已启用:
;启用xdebug zend_extension =“ / usr / lib / php / extensions / no-debug-non-zts-20160303 / xdebug.so” xdebug.remote_enable =在xdebug.remote_handler = dbgp上 xdebug.remote_host =本地主机xdebug.remote_port = 9000 xdebug.max_nesting_level = 500
在httpd.conf
中,我像这样加载PHP模块:
LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so
我检查了httpd.conf是否未包含在其他文件中(由this answer建议)。我知道了:
包括“ /Applications/XAMPP/xamppfiles/apache2/conf/httpd.conf”
但是该附加配置文件仅包含虚拟目录。
我的phpinfo吐出此PHP版本:
PHP版本7.1.13
我已经阅读到Apache 2的PHP cli和PHP模块不一定具有相同的版本,但这是我的问题:
为什么要在PHP cli中正确加载intl模块,而不是在Apache2 PHP模块中正确加载?
PS:关于加载不正确的模块的日志中没有错误,在我将其从php_intl.dll
重命名为intl.so
之前,没有错误了。
答案 0 :(得分:0)
XAMPP具有自己的捆绑的Apache + PHP。它以php作为apache模块运行。
要将php作为apache模块运行,您应该使用--with-apxs参数从源代码重新编译mod php。