Problem/Motivation

In mydomain.com/update.php, I tried to update the database, but it says "Multibyte string input conversion in PHP is active and must be disabled. Please refer to the PHP mbstring documentation for more information.

This is the full msg: Error: Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information.

Steps to reproduce

Reload mydomain.com/update.php as described above and an error will occur.

I have tried the following responses based on various, community posts, but the message persists.

- php.ini
Ensure that the settings are as follows

mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation = Off

- /public_html/sites/default/settings.php
Add the following code to the top of the file

ini_set('mbstring.http_input', 'pass');
ini_set('mbstring.http_output', 'pass');

- .htaccess
Add input and output code under "php_value assert.active 0" as follows.

<IfModule mod_php.c>
  php_value assert.active                   0
  php_value mbstring.http_input             pass                                
  php_value mbstring.http_output            pass                                
</IfModule>

It may be related to the fact that "mbstring.http_input" and "mbstring.http_output" are deprecated in php8, but I don't know how to solve it specifically.

Any advice would be appreciated.

CommentFileSizeAuthor
Capture of the error.png59.5 KBcarrotandme

Comments

carrotandme created an issue. See original summary.

carrotandme’s picture

Title: Drupal9/PhP8: [Error] Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information. » [Drupal9/PHP8] Error: Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information.
carrotandme’s picture

Issue summary: View changes
cilefen’s picture

Category: Task » Support request

This is a support request. What is the actual runtime value? You can find that on the as shown on this old article: https://www.drupal.org/node/59680

I think it’s in the same place for Drupal 9.

carrotandme’s picture

@cilefen
Thank you for your response.
I am sorry, but what exactly do you mean by "Runtime Value"?
By the way, I was able to get the php information with phpinfo.

cilefen’s picture

That’s good. What are the runtime values? By “runtime” I mean the effective values in the web platform context, rather than in various configuration files.

cilefen’s picture

quietone’s picture

Title: [Drupal9/PHP8] Error: Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.encoding_translation setting. Please refer to the PHP mbstring documentation for more information. » update.php fails with Multibyte string input conversion in PHP is active and must be disabled.
Issue summary: View changes

Trimming the title and moved the error msg to the IS.

cilefen’s picture

Status: Active » Postponed (maintainer needs more info)
carrotandme’s picture

Thanks for the reply.
I don't know if this answers your question, but I will list below the values of the properties that would be relevant.

Multibyte Support	enabled
HTTP input encoding translation	disabled
Directive	Local Value	Master Value
mbstring.detect_order	auto	auto
mbstring.encoding_translation	Off	Off
mbstring.http_input	pass	pass
mbstring.http_output	pass	pass
mbstring.http_output_conv_mimetypes	^(text/|application/xhtml\+xml)	^(text/|application/xhtml\+xml)
mbstring.internal_encoding	UTF-8	UTF-8
mbstring.language	Japanese	Japanese
mbstring.regex_retry_limit	1000000	1000000
mbstring.regex_stack_limit	100000	100000
mbstring.strict_detection	Off	Off
mbstring.substitute_character	no value	no value
s427’s picture

Subscribing because I'm seeing the same error (on the admin/reports/status page) after switching from PHP 7.4 to PHP 8.1.14, with Drupal 9.5.4.

On the phpinfo page (accessed from the Drupal status page), the value for mbstring.encoding_translation is Off (local) and Off (master).

Is it safe to operate Drupal (e.g. create or edit nodes) while this error is showing?

s427’s picture

Update: my hosting provider uses a system with a ".user.ini" file to store user defined PHP settings.

Originally, this file had the following line (among others):
mbstring.encoding_translation = "off"

If I replace "off" by "0" (zero) in that line, then the warning in Drupal goes away.

I'm not sure which value is "more correct" ("off" or "0"), but perhaps the check in Drupal (link in comment #7) should be updated to test for "off" in addition to "0"? Since the phpinfo page shows "off", I'm guessing it's a valid value.

cilefen’s picture

According to the docs in https://www.php.net/manual/en/configuration.file.php,

; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

Are the quotation marks the problem?

bushrang3r’s picture

OP's php.ini lines did the job for me.
The server was set to "Off" and I was getting the same error until I added the php.ini lines with "0" instead of "Off". No more errors.

mbstring.http_input = pass
mbstring.http_output = pass
mbstring.encoding_translation = Off 0

cilefen’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

I am closing this as there have been no replies. Reopen it if needed.