Florian Peschka Florian Peschka - 1 year ago 136
PHP Question

mbstring missing from phpinfo but enabled in php.ini

Similar to this question: gd2 not showing in phpinfo, is showing in php -i

I have the same problem with

. I enabled it in my
(which is the only
on my whole system - and yes, I checked and double checked that!
), but when I open up
on my Apache, mbstring is missing. If I do
php -i
, all of the
data is showing up nicely.

Apache (

Configuration File (php.ini) Path C:\Windows
Loaded Configuration File F:\PHP\5.4\php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)

Apache (

Fatal error: Call to undefined function mb_get_info()
in F:\Apache\httpd-2.4\htdocs\index.php on line 2


F:\Apache\httpd-2.4\htdocs> php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: F:\PHP\5.4\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)

F:\Apache\httpd-2.4\htdocs> php index.php
array(14) {
string(10) "ISO-8859-1"
string(4) "pass"
string(31) "^(text/|application/xhtml\+xml)"
string(11) "no overload"
string(5) "UTF-8"
string(6) "BASE64"
string(6) "BASE64"
string(3) "Off"
string(7) "neutral"
array(2) {
string(5) "ASCII"
string(5) "UTF-8"
string(3) "Off"

What is happening here? Bugs in

Answer Source

The problem is, that when PHP is loaded via apache, the extension_dir is apparently read relative to the apache server root dir.

But, starting from command line, it is read relative to the PHP root dir.

Thus, despite it being the same loaded php.ini, because I set the extension dir as ext instead of F:\PHP\5.4\ext, apache (or rather: PHP) searched for it in F:\Apache\2.4\ext, which it didn't find for obvious reasons.

Setting the extension_dir to an absolute folder solved the issue. Now apache and cmd both load the exact same configuration, including all extensions (which is exactly how I wanted it).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download