Call to undefined function mb internal encoding

I’m trying to install indefero on a CentOS 5.3 VMware ‘box’ and I ran into a problem. Quite early in the installation I get an error that I’ve been able to narrow down to this:

I get the same error when calling this script via http through Apache. Now according to the PHP manual the mb_internal_encoding function should be a builtin in PHP 5.

I have CentOS 5.3 i386 (Linux code 2.6.18-53.1.21.el5 #1 SMP Tue May 20 09:34:18 EDT 2008 i686 i686 i386 GNU/Linux) and I’ve installed PHP 5.2.9.

I double checked: selinux has been disabled (for now).

How do i fix this?

5 Answers 5

mbstring is a "non-default" extension, that is not enabled by default ; see this page of the manual :

mbstring is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with the configure option. See the Install section for details

So, you might have to enable that extension, modifying the php.ini file (and restarting Apache, so your modification is taken into account)

I don’t use CentOS, but you may have to install the extension first, using something like this (see this page, for instance, which seems to give a solution) :

(The package name might be a bit different ; so, use yum search to get it 🙂 )

В журнал вэб-сервера записываются ошибки Call to undefined function mb_internal_encoding.
Сие говорит о том, что: либо эта функция отключена директивой disable_functions (настройки в php.ini или в конфигурационном файле сайта, в директории pool.d), либо отключен модуль mbstring.so (закомментирован в файле 20-mbstring.ini в директории conf.d), либо модуль mbstring не установлен (пакет php*.*-mbstring).
Проверяем, установлен ли пакет:

dpkg —get-selections | grep mbstring

В случае отсутствия оного, ищем доступные версии:

Выбираем версию , соответствующую версии установленного PHP интерпретатора, и устанавливаем её:

Если же пакет уже был установлен, то правим конфигурационные файлы.

Comments

Copy link Quote reply

tripu commented Sep 1, 2016 •

NB: I’m running PHP7, not PHP5 as stated in the docs. If that’s the cause of the problem, apologies beforehand! (but I don’t see how that could be; mb-internal-encoding exists in both versions).

When visiting http://localhost/i18n-checker/tests/ on my browser as explained in the docs, the Apache logs show this, and the page doesn’t render:

Line 257 of src/class.N11n.php calls function mb-internal-encoding . The only definition I can find is in lib/phpQuery.php .

This comment has been minimized.

Copy link Quote reply

r12a commented Sep 1, 2016

Does your PHP initialisation load the mbstring extension?

This comment has been minimized.

Copy link Quote reply

tripu commented Sep 1, 2016

Thanks. I installed the package php-mbstring , restarted Apache, and now the page shows this:

Successfully parsed 190 tests from local test files.
Character encoding HTML HTML5 XHTML(H) XHTML(X) XHTML11
1 rep_charset_no_in_doc

But these resources can’t be found:

  • http://localhost/i18n-checker/tests/style/base_ucn.css
  • http://localhost/i18n-checker/tests/scripts/mootools-1.3.2.js
  • http://localhost/i18n-checker/tests/images/w3c.png

And there is still an error:

This comment has been minimized.

Copy link Quote reply

r12a commented Sep 1, 2016

But these resources can’t be found:

That should now be fixed by e9ba65f As it’s only for development use, i never reallly worried about styling etc for that page. I must admit that it looks pretty now though.

This comment has been minimized.

Copy link Quote reply

r12a commented Sep 1, 2016

PHP Warning: fopen(../logs/i18n.log): failed to open stream: Permission denied in i18n-checker/lib/log4php/appenders/LoggerAppenderFile.php on line 77
PHP Fatal error: Uncaught Error: Call to undefined function curl_init() in i18n-checker/src/class.Net.php:151
Stack trace:
#0 i18n-checker/src/class.Net.php(57): Net::fetchDocument(‘http://localhos. ‘)
#1 i18n-checker/src/class.Test.php(209): Net::getDocumentByUri(‘http://localhos. ‘)
#2 i18n-checker/tests/index.php(118): Test::startCheck(‘http://localhos. ‘, false)
#3


thrown in i18n-checker/src/class.Net.php on line 151

curl_init exists in PHP 5 and 7.

Do you have that extension enabled in your php.info file?

This comment has been minimized.

Copy link Quote reply

r12a commented Sep 1, 2016

I added to the installation notes on the wiki:

You will also need the mbstring and curl extensions enabled.

This comment has been minimized.

Copy link Quote reply

tripu commented Sep 1, 2016 •

Logo, CSS and JS are loading fine now, thanks.

I installed php-curl and the error now is:

And the table on the page looks broken and has just one cell (the one containing rep_charset_no_in_doc ).

Any idea? (Now this might have to do with me running PHP 7 instead of 5.)

This comment has been minimized.

Copy link Quote reply

tripu commented Sep 1, 2016

PHP Fatal error: Uncaught Error: Class ‘DOMDocument’ not found […]

Fixed by installing php-xml too and restarting Apache.


[an error occurred while processing the directive]
Карта сайта