PHP mbstring.func_overload ignored in .user.ini - php

I have mbstring.func_overload = 7 in my php.ini, and I need to have it set to 0 for one directory. I have found out I cannot use .htaccess when using PHP via mod_fcgid as I do in my Debian installation.
I have created a .user.ini in the directory where I want this setting set to 0 and I also placed a test.php containing a phpinfo(); line inside the same directory, to see if this .user.ini takes effect.
Beside of the setting above that I WANT to change I also put some other PHP settings in this .user.ini files which I will not keep there, they are just to notice if something actually changes.
My .user.ini:
post_max_size = 12M
upload_max_filesize = 128M
[Date]
date.timezone = "UTC"
[mbstring]
mbstring.language = German
mbstring.func_overload = 0
The strange thing is: all the above settings are accepted and shown as they are in my .user.ini when requesting the test.php file, as "local" settings, except one: mbstring.func_overload is still 7 both for local and global configuration.
Any hints why mbstring.func_overload is ignored while other PHP settings in my .user.ini work perfectly?

I have same problem. I can change any mbstrings-settings in .user.ini, but not mbstring.func_overload.
UPD: I found a reason - mbstring.func_overload can't be redefined in .user.ini, because have status PHP_INI_SYSTEM.
This setting can only be changed from the php.ini file.
Solution. Add follow lines into nginx.conf:
`
location ~ \.php$ {
fastcgi_param PHP_VALUE "date.timezone='Europe/Berlin'
mbstring.func_overload=2
memory_limit=1024M";
...another fastcgi-options...
}
`

Related

Issue with increase local memory_limit [duplicate]

I have a clean install of a CentOs with php 5.2.13.
In php.ini that is loaded and present in the header of phpinfo() I have
safe_mode=off
in the phpinfo() information I have
// local value - safe_mode: On
// master value - safe_mode: off
the php file has only a phpinfo() function.
I am still looking for vhost file to see if any directives are there overwriting this, but still then any sugggestions?
Look for "Additional ini files parsed" in phpinfo() output. This setting can also be changed in the Apache config (including .htaccess files).
"Master Value" (from php.ini) could be overridden with "Local Value" in httpd.conf, .htaccess or other Apache configuration with php_value directive.
I found the problem/solution to be in the extra config file that is added in the vhosts folder.
The file is named httpd.include and it has this line
php_admin_flag safe_mode on
PS. I really hate when other systems create files on the fly like this, especially with values they want.

EasyApache Php configuration on LAMP server with WHM

With EasyApache3 and Php5.4, the server was setup whereby the parameter values in the master php.ini file could be adjusted per account using a local php.ini file located in the account root. Having upgraded to EasyApache4 and Php 5.6 this configuration structure does not seem to be working, the local php.ini file shows as loaded in phpinfo.php but the parameters set do not change the master values eg:
post_max_size 20M
And ideas please?
With EA4 by default there's one server-wide php.ini located at /opt/cpanel/ea-php56/root/etc/php.ini but when the MultiPhp Editor is used I believe it creates ini files at /opt/cpanel/ea-php56/root/etc/php.d/local.ini, public_html/php.ini, and public_html/.user.ini where the hierarchy is:
php.ini > local.ini > .user.ini
So .user.ini over-rides local.ini which over-rides the server-wide php.ini
Although the MultiPhp editor creates it, public_html/php.ini seems not to be used as long as user_ini.filename is not set, since the default for user_ini.filename is .user.ini, and as long as there is not a directive in .htaccess
Ref: https://forums.cpanel.net/threads/ea4-php-ini-local-ini-behavior.559871/

Can't disable multibyte string input conversion for Drupal 8 install

I've installed a lot of Drupal sites and never had this problem before. On attempting to install 8.1.2 I get an error that says:
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.
The .htaccess file that comes with Drupal already has a section that should disable this:
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_value assert.active 0
php_flag session.auto_start off
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_flag mbstring.encoding_translation off
# PHP 5.6 has deprecated $HTTP_RAW_POST_DATA and produces warnings if this is
# not set.
php_value always_populate_raw_post_data -1
</IfModule>
I've tested and this .htaccess file is used. The server is running a new installation of CentOS 7 with cPanel/WHM. I also changed the PHP settings (using WHM) to:
; http input encoding.
mbstring.http_input = pass
; http output encoding. mb_output_handler must be
; registered as output buffer to function
mbstring.http_output = pass
Though I don't think that's notably different than what the defaults were. I checked that this was the actual php.ini file used. I have restarted Apache.
The solution was to enable the mbstring extension.

custom php.ini / php_value : which takes precedence?

We could override the default php.ini settings using the
PHPINIDir /var/www/web1
directive in <VirtualHost> decription.
But I have seen php_value statements which is applied to all the sites in the httpd.conf files. For example :
php_value upload_max_filesize somevalue
Will the general settings like above override the custom php.ini settings?
Pardon me that I don't have an environment to test this out at present.
PHP configuration precedence order is as follows:
The php.ini
The conf.d directory. On some distros, there is a modularized conf.d directory. values specified in there override php.ini
The directive PHPINIDir /var/www/web1 replaces 1 and 2 with your custom php.ini
Apache virtual host configuration. e.g. "php_value error_reporting " overrides any php.ini
.htaccess files placed inside your webspace override the above configuration
Source code values specified in the source code override all other configuration
Some (security critical) options can only be set in higher level config files

How do I disable Multibyte string input conversion in PHP?

I am attempting to install Drupal 7 on my local debian jessie machine, and it is telling me the following:
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.
Ok, so I head over to the php documentation linked in that message and it provides me with a lot of (helpful, I am sure) information not at all related to disabling "Multibyte string input conversion". If it's there, I didn't find it.
I googled and came up with a thread on drupal.org, which claims:
Since Drupal made it mandatory to disable mbstring.http_input and its
'relatives', a lot complaints regarding Drupal installation was raised
everywhere in cyberspace. It's not a problem if you own your own
server, and there's a lot of workaround.
And provides a link to a page that I add the following to my .htaccess file:
php_value mbstring.http_input pass
php_value mbstring.http_output pass
So I had a look in my .htaccess file and found this:
# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
php_flag magic_quotes_gpc off
php_flag magic_quotes_sybase off
php_flag register_globals off
php_flag session.auto_start off
php_value mbstring.http_input pass
php_value mbstring.http_output pass
php_flag mbstring.encoding_translation off
</IfModule>
Right, so now what?
EDIT: Just added the following line to my php.ini file:
mbstring.http_input = pass ; No conversion.
and ran service apache2 reload. No effect.
Added the following to my php.ini file:
mbstring.http_input = pass ;
mbstring.http_output = pass ;
then I ran
sudo service apache2 reload
And then I could install drupal manually, however, if I try using drush I still get the error, so this is really just half a solution...
Instead you can edit your site's .htaccess file or settings.php file to do so.
This way there will not be any conflict between your site and your drush configuration. And in case you changed your server's php version in the future, you don't have to re-do the same changes to the new php version's php.ini file.
Via .htaccess:
php_value mbstring.http_input pass
php_value mbstring.http_output pass
Or via settings.php:
ini_set('mbstring.http_input', 'pass');
ini_set('mbstring.http_output', 'pass');
To disable mbstring function overloading without disabling mbstring, you have to use
mbstring.func_overload = 0
This can be set in the php.ini file, and if not set there, in the vhost setting or .htaccess.
If it does not work, try looking for an mbstring.ini file, for example in /etc/php.d/mbstring.ini. This gets loaded after php.ini, and will override any value set there.
You may also need to add the following, however this is already set in Drupal's htaccess file, so if this file is being loaded correctly there should be no change.
php_value mbstring.http_input pass
php_value mbstring.http_output pass
For me, installing php-mbstring module helped to resolve this error.
the same error here with the installation of a drupal demo
but I realised that the site has no .htaccess file
I copied one into the site
and the problem disappeared
Uncomment extension=php_mbstring.dll in php.ini file and restart apache
Drupal is asking you to enable the mbstring (multibyte string), but your default php settings has this option disabled. If you can change your php.ini file to enable this, then your problem will be fixed, but sometimes we don't have access to that file.
Instead, we can set drupal to enable this option only for this particular site. On your sites/default/settings.php file (or the respective copy you may be using), add this:
ini_set('mbstring.http_input', 'pass');
ini_set('mbstring.http_output', 'pass');
and reload your php
This will set the mbstring option for this particular drupal site. If this still fails, it may be possible that your server's php does not have mbstring installed at all. Run phpinfo() in your browser and search for a mbstring section. If you don't find it at all, then you need to install it or ask a server administrator to do it for you

Categories