我已经设法在我的机器上启用了intl模块(这很棘手),当我执行php -m | grep intl时,我会看到列出的模块。我的问题是,该模块似乎已启用,但XAMPP可能仍在加载其他版本的PHP。
which php的输出是:
/usr/local/opt/php@7.1/bin/php
php -v的输出是:
PHP7.1.26 (cli) (建于:2019年2月26日10: 26 :24)版权(c) 1997-2018年PHP v3.1.0,版权(c) 1998-2018 Zend OPcache v7.1.26,版权(c) 1999-2018
php -i | grep intl的输出是:
配置命令'--with-config-file-path=/usr/local/etc/php/7.1‘=>’./配置‘-前缀=/usr/local/var/php@7.1/7.1.26’-localstatedir=/usr/local/var‘-sysconfdir=/usr/local/etc/php/7.1’=>“'--with-pear=/usr/local/Cellar/php@7.1/7.1.26/share/php@7.1/pear‘”--启用-bcMath’‘--启用-日历“--启用-dba”--启用-dtrace’--启用-exif‘’-启用-ftp‘-启用-fpm’-启用-intl‘’-启用-mbregex‘’-启用-mbstring“-启用-mysqlnd”-启用-opcache-file‘-启用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‘-group=_www’-with-freetype-dir=/usr/local/opt/freetype‘-with-www’-with-fpm-group=_www‘-with-freetype-dir=/usr/local/opt/freetype’-with-www‘-with-fpm-group=_www’-with-freetype‘-with-fpm’-group=_www‘-with-freetype-dir=/usr/local/opt/freetype’‘-with-fpm’-group=_www‘-with-freetypegd‘’-with-gettext=/usr/local/opt/gettext‘-with-gmp=/usr/local/opt/gmp’'--with-iconv=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr‘’-with-icu-dir/local/opt/icu4c‘-with-jpeg-dir=/usr/local/opt/jpeg’-with-kerberos=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr‘’-与-布局=GNU‘’-与-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=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr’‘-with 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-p拼写=/usr/opt/A拼写’-with-sqlite3=/usr/usr/opt/libpng‘-with-p拼写=/usr/opt/本地/opt/sqlite‘-with-tidy=/usr/local/opt/tidy html5 5’-with=/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/unixodbc’-with=/xmlrpc/xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr‘intl intl.default_locale =>无值=>无值intl.error_level => 0 => 0 intl.use_exceptions => 0 => 0
以下是我的bash配置文件中的路径:
导出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=on xdebug.remote_handler=dbgp xdebug.remote_host=localhost xdebug.remote_port=9000 xdebug.max_nesting_level=500
在httpd.conf中,我像这样加载PHP模块:
/usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so LoadModule php7_module
我已经检查过httpd.conf没有包含在附加的文件中(正如this answer建议的那样)。我拿到了这个:
包括"/Applications/XAMPP/xamppfiles/apache2/conf/httpd.conf“
但该附加配置文件仅包含虚拟目录。
我的phpinfo吐出了这个PHP版本:
PHP7.1.13版
我读过Apache2的PHP和PHP模块不一定有相同的版本,但我的问题是:
为什么intl模块在PHP中正确加载,而不是在Apache2 PHP模块中加载?
PS:日志中没有关于加载不正确模块的错误,在我将它从php_intl.dll重命名为intl.so之前,已经没有了。
发布于 2019-11-08 20:55:27
XAMPP有自己的捆绑Apache+PHP。它以apache模块的形式运行php。
要将php作为apache模块运行,您应该使用参数- with从源代码重新编译mod php。
https://stackoverflow.com/questions/54909767
复制相似问题