问题
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
- Turn off all the apache services
- Run cmd as administrator
- Go to the bin folder of apache, in my case, with the command
cd C:\Apache24\bin
- 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