PHP mbstring doesn't work with Apache on Windows

丶灬走出姿态 提交于 2020-01-23 03:50:27

问题


I have to get PHP 5.4 (32 bit, TS) with mbstring running with Apache 2.4 (32 bit) on Windows. In my httpd.conf I set this:

PHPIniDir "c:/php54"
LoadModule php5_module "c:/php54/php5apache2_4.dll"
AddHandler application/x-httpd-php .php

And in my php.ini:

extension_dir = "ext"
...
extension=php_mbstring.dll

Now, when I execute php -m it correctly says that mbstring is loaded:

...
libxml
mbstring
mcrypt
...

And php -i spits out a section about mbstring:

mbstring

Multibyte Support => enabled
Multibyte string engine => libmbfl
HTTP input encoding translation => disabled
libmbfl version => 1.3.2
...

But, when I have a simple index.php with <?php phpinfo(); ?> there is no word about mbstring, even though it says the correct php.ini was used.

When I change index.php to <?php echo mb_convert_case("hello world", MB_CASE_UPPER); ?> it errors with

Fatal error: Call to undefined function mb_convert_case() in C:\Apache24x86\htdocs\index.php on line 1

I can run the exact same script with PHP CLI php index.php and it correctly prints HELLO WORLD.

Why is mbstring working in php.exe, but not in Apache? Of course I restarted Apache numerous times and even my whole PC.


回答1:


I had the same problem and I solved it with a cmd command

  1. Turn off all the apache services
  2. Run cmd as administrator
  3. Go to the bin folder of apache, in my case, with the command cd C:\Apache24\bin
  4. create a symbolic link with the file php.ini with the command bin>mklink php.ini C:\php\php.ini

Example:

I hope this will help you solve your problem.



来源:https://stackoverflow.com/questions/34263544/php-mbstring-doesnt-work-with-apache-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!