Jump to content
MDDHosting Forums

PHP Mysql question setting variables


stfual

Recommended Posts

Hello

 

Im trying to install and test Textpattern on an Mddh shared hosting account. It basically works but ive had some problems with data corruption in language tables that hold double byte characters. Ive requested support from the application and theyve been helpful but nobody is aware of this problem and the application is part of softalicious and "just works" on some other hosting vendors.

 

When i look at a working system I find the following:-

 

Charset (default/config): latin1/utf8

character_set_client: utf8
character_set_connection: utf8
character_set_database: utf8
character_set_filesystem: binary
character_set_results: utf8
character_set_server: latin1
character_set_system: utf8

 

 

On my Mddh install they are currently

 

Charset (default/config): latin1/utf8mb4
character_set_client: latin1
character_set_connection: latin1
character_set_database: utf8mb4
character_set_filesystem: binary
character_set_results: latin1
character_set_server: latin1
character_set_system: utf8

 

 

With support from Mddh I have been able to change “character_set_database” from ‘latin1’ to ‘utf8mb4’ by changing the collation setting in Phpmyadmin after database creation, prior to running install script. It hasn’t changed anything re. the problem. "character_set_connection" looks like it could be a big problem.

 

I note that the default on both systems is latin1. It seems that most hosting systems are set with a default of swedish latin1.


Presumably the settings on the working host were either configured by the install script, or manually, or are set in a session script or .ini file.
I note that hosts in general now dont allow access to config files for PHP and MySql.

 

Can i set the the others as session variables in .htaccess ? If not Is there any other way to set them on a session basis ?

 

 

 

 

 

Link to comment
Share on other sites

If you update your ticket with this - basically the part about the connection character set - we can probably advise.

 

My first Google search found this:

https://www.toptal.com/php/a-utf-8-primer-for-php-and-mysql

 

I assume it's similar for utf8mb4

 

From that article:

default_charset = "utf-8";

I'm guessing that if you add this to your .htaccess file:

php_value default_charset "utf8mb4"

It may alleviate your issue - as that will cause PHP to use that character set. If it does - then the data is being stored/read from the database properly.

 

If that doesn't alleviate your issue - you may have to specify the character set on the connection.

 

That said - without a ticket I'm just giving my best guess without looking into anything. If you open a ticket I can definitely perform some queries on your database to see if I get garbled/corrupted data back or not from MySQL directly.

Link to comment
Share on other sites

It looks like we resolved a similar issue for somebody else yesterday with this in their .htaccess file:

AddCharset iso-8859-1 .php
php_value default_charset iso-8859-1

I assume you would replace "iso-8859-1" with "utf8mb4" like so:

AddCharset utf8mb4 .php
php_value default_charset utf8mb4

If this solves your issue do please reply here and let us know. If it doesn't - do please open a ticket so we can look into it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...