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

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.

Related

Directive 'safe_mode' is no longer available in PHP in Unknown on line 0

I have got this error PHP Fatal error: Directive 'safe_mode' is no longer available in PHP in Unknown on line 0 when I have updated my hosting PHP version from 5.6 to 7.2
how can I solve this problem or I must contact my hosting provider ?!
here is my php.ini setting file found in my mean path
; cPanel-generated PHP ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
magic_quotes_gpc = Off;
register_globals = Off;
default_charset = UTF-8;
memory_limit = 64M
max_execution_time = 36000
upload_max_filesize = 999M
safe_mode = On;
mysql.connect_timeout = 20;
session.auto_start = Off;
session.use_only_cookies = On;
session.use_cookies = On;
session.use_trans_sid = Off;
session.cookie_httponly = On;
session.gc_maxlifetime = 3600
allow_url_fopen = On
display_errors = On
;error_reporting = E_ALL;
allow_url_include = On
enable_dl = On
file_uploads = On
max_input_time = 60
max_input_vars = 1000
post_max_size = 8M
session.save_path = "/var/cpanel/php/sessions/ea3"
zlib.output_compression = Off
First, you should read up on safe_mode. In the docs, will see that:
Warning: This feature has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
Second, you can get the error to go away by removing this line:
safe_mode = On;
NOTE: You must be certain to find the correct INI file. Some operating systems or methods of installing PHP will have a separate php.ini file for the web server and Command Line Interface (CLI). For example, on my ubuntu workstation, I have one for apache and one for CLI:
/etc/php5/cli/php.ini
/etc/php5/apache2/php.ini
To find out what INI file you should edit, I suggest looking at the output of phpinfo() and looking at the value for Loaded Configuration File. To do that on a web server, use this file:
<?php
phpinfo();
If you want to find out where the php.ini file is for CLI scripts, you can use this command:
php -i | grep "Loaded Configuration File"
If you are make changes to the ini file for your web server, you'll need to restart the web server for this change to take effect. On Ubuntu or other debian-based distros, you might do that with a command like so:
sudo service apache2 restart
You may need to tweak that command, depending on distro, distro version, apache version, etc. I believe that for CentOS or Red Hat-based distros, one of these should work:
sudo service httpd restart
sudo apachectl restart
NOTE: If your machine is configured to use php-fpm for handling PHP requests, then things work differently for your web server. Your system will maintain a process pool of PHP processes entirely separate from your web server. You will need to restart the PHP process pool. The command to accomplish that varies widely depending on the distro and your version of PHP. Check this page for your distro and see if you can find one that works.
For CLI invocations of PHP, the changes should take effect each time you run a new php script. You shouldn't have to restart anything for new commands to see the changes you made. If you have some long-running PHP script for some reason (very unusual) then you'd need to halt that process and re-invoke it after making your INI changes.
EDIT: I'd also point out that your INI file very clearly states you might get weird behavior on your CPANEL system. Make sure you follow its instructions:
; cPanel-generated PHP ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

PHP configuration based on each domain user Not working when fastcgi apache server is running

I have configured php configuration for each domain account like below in the file
/etc/sentora/configs/apache/phpconfig/domain_user.conf
That file i have made like below. For only the particular domain.
<Directory "/var/sentora/hostdata/domain_user/">
php_value upload_max_filesize 512M
php_value post_max_size 512M
php_value max_execution_time 100
php_value max_input_time 100
php_value memory_limit 512M
php_value file_uploads Off
</Directory>
Also I have configured below in the file "/etc/sentora/configs/apache/httpd.conf" correctly.
IncludeOptional /etc/sentora/configs/apache/phpconfig/*.conf
So it is working for me if i have changed my domain php version to 5.6, But its not working when I am checking after changed the php version to 7.0
It seems like when my server core php version is 5.6 its working on the version 5.6.
php_value {key} {value} was working when I used in mod_php but not in fastcgi
My phpinfo like below when its 7.0
enter image description here
And when my domain is in php 5.6 my phpinfo look like below.
enter image description here
Can anyone help me to out from this?
Thanks in advance.
Use this:
php_value auto_prepend_file /path/to/includefile/includefile.php
Then put your php_values in there

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

Php htaccess ignore repated source fails to enabled

I am setting up my htaccess and tried to switch from display_errors to log_errors .. I got the log_errors and error_log working, so now I get errors logged into phpLogfile.txt. But I now want to get rid of the iterating messages. That's why I tried to enable ignore_repeated_errors and ignore_repeated_source.
I put this line of code in my script:
require_once('stupid.php')
and of course this gives an error but the error will be logged over and over again.
I tried several alternatives like:
php_flag ignore_repeated_source 1
php_flag ignore_repeated_source on
php_flag ignore_repeated_source ON
php_flag ignore_repeated_source On
Since php.net says this setting is changeable as PHP_INI_ALL there must be a mistake on my site.
Am I missing something?
php_value error_reporting 2047
php_value display_errors 1
php_value log_errors 1
php_value error_log C:\xampp\htdocs\html\zillion_strato\phpLogfile\phpLogfile.txt
# disable repeated error logging
php_value ignore_repeated_errors on
php_value ignore_repeated_source on
# save last error msg in variable
php_flag track_errors on
#protect/prevent looking up the path
<Files C:\xampp\htdocs\html\zillion_strato\phpLogfile\phpLogfile.txt>
Order allow,deny
Deny from all
Satisfy All
</Files>
I see you've tried lots of random stuff and are apparently not getting clear feedback from the server so I think I'd better give you some tips (rather that just some code to copy to paste blindly).
Let's have a look at the relevant documentation:
The Runtime Configuration section offers most of the relevant details (though I admit it could use a short introduction).
Since you want per-directory changes and your question suggests you're running PHP as Apache module, details can be found at Running PHP as an Apache module.
The directive itself is documented at List of php.ini directives.
About your attempts:
ignore_repeated_source 1
ignore_repeated_source on
ignore_repeated_source ON
ignore_repeated_source On
None of these are listed among the Apache directives defined by mod_php, which are these:
php_value name value
php_flag name on|off
php_admin_value name value
php_admin_flag name on|off
You should be getting a 500 Server Error status code and an clear error message in the Apache logs. If you don't, there's possibly something wrong with your Apache set up.
php_value ignore_repeated_errors on
php_value ignore_repeated_source on
These directives are documented like this:
ignore_repeated_errors boolean
ignore_repeated_source boolean
I haven't tested this but you should be getting the original values in e.g. phpinfo(). Boolean directives are set with the php_..._flag directives.

PHP mbstring.func_overload ignored in .user.ini

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...
}
`

Categories