Project:Drupal core
Version:6.x-dev
Component:install system
Category:task
Priority:critical
Assigned:saiedar
Status:closed (fixed)

Issue Summary

Drupal requires that mbstring must be disabled to run properly. Actually, if you have it enabled, you will have the following message on your setting page:

Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information.

I was wondering, as it is a requirement, why not force it to the required values in the settings.php file, together with the other "ini_set" entries. Just like this:

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

Well... I'm not aware of any side effect of it, but maybe I'm wrong.

Regards,
Frederico Caldeira Knabben
----
http://www.fckeditor.net
"Support Open Source Software"

Comments

#1

These values must be set before PHP is started... we could htaccess to set them. But that would only help people with htaccess ability. Feel free to make a patch. We also need to disable function overloading.

#2

Status:active» needs work

Ok, the htaccess patch would be much better. Just add the following lines to the root htaccess of Drupal for each PHP related "IfModule" block:

php_value mbstring.http_input pass
php_value mbstring.http_output pass

The following lines could also be added to the settings.php for those without htaccess:

// mbstring must be disable. It is done by default using the htaccess file.
// If you can't use htaccess, the better solution would be setting it in the
// php.ini file.
// The last solution is uncommenting the following lines.
//ini_set('mbstring.http_input', 'pass');
//ini_set('mbstring.http_output', 'pass');

But Steven said "These values must be set before PHP is started"... so, these changes settings.php will not be areal fix, right? Is there any explanation?

Well... I can't provide a patch for it, but the above lines will make it easy to implement it.

Thanks again.

#3

As this problem showed its face in 4.7.3, I was helped by these lines in settings.php on my 3 drupal sites:

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

Now, that I'm testing the CVS version of Drupal 5.0, I am presented with the error:

Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information. (Currently using Unicode library Error)

Again the two lines mentioned, put into settings.php, saved my day.

If this is the most correct sollution, I suggest its implemented in the shipping settings.php. If its NOT the correct sollution, I would also like to now, especially why it isn't, why I shouldn't use it, and what I should to insted. I don't think most users have access to the php.ini file on their host, so I expect this issue to affect quite some people if being ignored.

Best regards
Bjarne

#4

http_input affects how data such as GET and POST is processed. By the time PHP starts executing, $_GET and $_POST have already been created, and will not magically change just by calling ini_set(). All you do is trick Drupal into believing the problem is not there.e

#5

I agree with Steven's comment... this is why I believe the htaccess patch would be nice. In this way those with htaccess support will be ok with it right out of the box... for the others, the php.ini advice is ok.

#6

Well, I have access to the .htaccess file in the root directory of the Drupal installation but the fix as described by FredCK - adding the suggested lines for each PHP related "IfModule" block - did not work for me. I added the suggested lines to settings.php which at least removed the error message if not fixed the problem.

#7

Version:x.y.z» 6.x-dev

Moving out of the "x.y.z" queue to a real queue.

#8

None of these worked for me as there is one more setting mbstring.encoding_translation that needs to be overridden to continue with Drupal 5.0 installation. Place these three lines in a new .htaccess file in the root to get around this problem at install:

php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

#9

This didn't work for me. I'm running Drupal 5 on FC5 (ppc), PHP 5.1.6, apache 2.2.3.

#10

Title:Disable mbstring in settings.php» Disable mbstring in .htaccess

Changing title to match the issue.

To those testing the values: make sure AllowOverride is set in your Apache configuration. If you can turn on Clean URLs, you can be sure it works.

#11

Confirming that on my setup, AllowOverride is set to All (I can't test clean URLs because I can't install Drupal. The following error occurs when I hit install.php :

Incompatible environment
The following error must be resolved before you can continue the installation process:
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. (Currently using Unicode library Error)

#12

Assigned to:Anonymous» moshe weitzman
Status:needs work» reviewed & tested by the community

those 3 settings resolved my client's problem too. here is a patch. since it has worked for several people already, i set to RTBC.

i think this should be backported after commit to HEAD.

AttachmentSizeStatusTest resultOperations
patch_3.patch0 bytesIgnored: Check issue status.NoneNone

#13

now, with a patch

AttachmentSizeStatusTest resultOperations
mw.patch1.28 KBIgnored: Check issue status.NoneNone

#14

Category:feature request» bug report

Forgive me if this question seems stupid. This is the first time that I am attempting to install Drupal, and I got this error. I see that Moshe has posted a patch, but, frankly, I have no idea what to do with it. Is there a tutorial where I can find more information on this subject, or can someone describe exactly what to do with this patch. I attempted to create an .htaccess file at the root of my site with the contents of the patch file, but I get a server error when I attempt to visit my site. Removing the .htaccess file gets rid of the server error.

Any help that can be provided would be very greatly appreciated.

Thanks!

#15

Nevermind...
I added this to .htaccess and got it working.

php_value magic_quotes_gpc 0
php_value register_globals 0
php_value session.auto_start 0
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_value mbstring.encoding_translation 0

#16

Version:6.x-dev» 5.1
Component:base system» install system
Category:bug report» support request
Status:reviewed & tested by the community» postponed (maintainer needs more info)

I was also able to get Drupal to install by changing my .htaccess file with the info listed in comment #15. However, I am concerned about what sorts of problems will crop up in the future with this sort of solution. Can anyone tell me what else I need to do, or what other problems I might encounter by doing this?

This installation of Drupal is for a client on their shared hosting site, so I doubt I will get any access to php.ini file

#17

none of the methods listed worked for me all I get is an error that say "zero file size"

my host said try a custom php.ini file but I have no idea whaty to place in the file.

#18

Status:postponed (maintainer needs more info)» reviewed & tested by the community

no sense in holding this back. there are no drawbacks that i know of for the .htaccess solution. doing this in settings.php can be a bad idea, as mentioned earlier.

#19

Ok, I haven't tried the settings.php solution because of the mentioned problems. But the other solution (none of them) have worked for me. Can someone give a detailed explanation or show a copy of their .htaccess

#20

Version:5.1» 6.x-dev

#21

This drove me crazy, so for those out there that couldn't get the above to work in 5.1, placing the following AT THE TOP of your appropriate .htaccess section seems to work:

  php_flag mbstring.encoding_translation Off
  php_value mbstring.http_input pass
  php_value mbstring.http_output pass

#22

editing the .htaccess files did not solve my problem. continued to give me the problem till i created a php.ini file... Question is do I need to put this in every directory or just the root directory? my php.ini file only works in the folder it's located in.

#23

Version:6.x-dev» 5.x-dev
Status:reviewed & tested by the community» patch (to be ported)

This is a good safeguard and should have no side-effects elsewhere. Tested locally, and seems to work fine.

Committed to HEAD. Should probably be backported too.

#24

Category:support request» feature request

#25

Status:patch (to be ported)» fixed

Committed to 5.

#26

Status:fixed» closed (fixed)

#27

Warning

Here's the drawback from not paying attention to the following warning:

Operations on Unicode strings are emulated on a best-effort basis. Install the PHP mbstring extension for improved Unicode support.

Quoted from this comment in "Unicode library" in Status report?:

VeryMisunderstood

the mbstring extension has to do with multibyte characters in internationalization of Drupal. In other words languages. What will using it give you ? The ability to internationalize your site.

WHat risk do you run if you don't install it ? you site wont work with internationalization. In other words as the internet moves forward with multi language sites to reach a larger target audience, you will be left behind as your site will only work 100% properly in English.

Not so good workaround

Here's the drawback from using the settings.ini ini_set('mbstring.http_input','pass');ini_set('mbstring.http_output','pass'); workaround from the first two comments from Drupal 5.X Installation problems 'mbstring' error:

VeryMisunderstood

yes you can live without clean urls, however, you may find other serious limitations on a "free" host. They are typically more restricting then a shred host.

rosgar

If you're using imagecache module.

'Imagecache will not operate properly if Clean URLs is not enabled on your site.'

Solution

Do as the warning stated and demand your host to install the library. Some hosts might feel entitled to their conservative ways but there's some that will be happy to accommodate you and you can use this for leverage if the demand is not met.

I also documented this on my website: http://williamcarrier.com/en/page/mbstring-warning

#28

My techark host tech pointed me here and I'm assuming techark hosting will have this installed. This setting should set register_globals off for techark - I'll try this solution and after this one http://drupal.org/node/280724#comment-1048260

Actually, I'm not sure what part of this topic applies to turning off register_globals, techark is being quite vague in their support answers.

#29

Version:5.x-dev» 6.x-dev
Category:feature request» task
Priority:normal» critical
Assigned to:moshe weitzman» saiedar

add those two line and it will work perfectly ....
ini_set('mbstring.http_input','pass');
ini_set('mbstring.http_output','pass');
:)

#30

For unknown reasons, my server just doesn't know how to parse the default .htaccess file. Even though the default .htaccess file has all settings and their values neatly aligned, the server i am on doesn't accept space/tab between the setting and its value. After having struggled for a long while, i discovered that there could only be a single space character between "php_value mbstring.http_input" and "pass". Adding extra space/tab to align all values caused the server to skip parsing that setting.

So, if you experience that some of the settings in your .htaccess file gets ignored, try to remove all uneccesary space and tab characters.

#31

I can confirm that simply adding the two lines to the settings.php file worked flawlessly for me on php5 and apache:

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

Add it below the other similar lines and hopefully it will work for you too. ;)

#32

I had the same problems. Tried to include the stuff to .htaccess file. Did not work.
But your method to adding these lines to settings.php in sites/default/settings.php worked we.. Yes of course. It worked. Thanks.

nobody click here