ChrisJJ
ChrisJJ

Reputation: 2302

mb_detect_encoding() missing in PHP?

Using PHP 5.6.13 Windows CLI from http://windows.php.net/download#php-5.5, this:

include 'simple_html_dom.php'; //V1.5

$html = file_get_html('http://google.com');

fails with

Call to undefined function mb_detect_encoding()

and SO suggests this is due to the multibyte string extension missing. Indeed phpinfo() says

Zend Multibyte Support => disabled

which is is a surprise and disappointment.

What's the remedy? I want to remain with an official build.

Upvotes: 1

Views: 1072

Answers (1)

VolkerK
VolkerK

Reputation: 96189

The build package from windows.php.net contains everything you need to run the mbstring extension; it's just not enabled by default.

  • use <?php echo get_cfg_var('cfg_file_path'); to check which php.ini you have to edit
  • make sure the extension_dir=... directive points to the {yourPHPDir}/ext directory
  • add or uncomment* the line extension=php_mbstring.dll
  • (if php runs as a httpd module: restart the webserver; not the case here)

*) any line starting with a ; or (before php 7) # is concidered a comment.

Upvotes: 2

Related Questions