我必须在 Windows 上使用 Apache 2.4(32 位)运行带有 mbstring 的 PHP 5.4(32 位,TS)。在我的 httpd.conf 中,我设置了这个:
PHPIniDir "c:/php54"
LoadModule php5_module "c:/php54/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
在我的 php.ini 中:
extension_dir = "ext"
...
extension=php_mbstring.dll
现在,当我php -m
正确执行它时说 mbstring 已加载:
...
libxml
mbstring
mcrypt
...
并php -i
吐出一段关于 mbstring 的内容:
mbstring
Multibyte Support => enabled
Multibyte string engine => libmbfl
HTTP input encoding translation => disabled
libmbfl version => 1.3.2
...
但是,当我有一个<?php phpinfo(); ?>
没有关于 mbstring 的简单 index.php 时,即使它说使用了正确的 php.ini。
当我将 index.php 更改为<?php echo mb_convert_case("hello world", MB_CASE_UPPER); ?>
它时出现错误
Fatal error: Call to undefined function mb_convert_case() in C:\Apache24x86\htdocs\index.php on line 1
我可以使用 PHP CLI 运行完全相同的脚本php index.php
并正确打印HELLO WORLD
.
为什么 mbstring 可以在 php.exe 中工作,但不能在 Apache 中工作?当然,我多次重新启动 Apache,甚至我的整个 PC。