Jump to content


Photo

PHP Mysql question setting variables


  • Please log in to reply
3 replies to this topic

#1 stfual

stfual

    Newbie

  • Members
  • Pip
  • 3 posts
  • Gender:Male

Posted 04 October 2016 - 09:56 AM

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 ?

 

 

 

 

 


  • 0

#2 MikeDVB

MikeDVB

    Forum Administrator

  • Staff Administrator
  • PipPipPipPipPip
  • 2,561 posts
  • Gender:Male
  • Location:Central Indiana, USA

Posted 04 October 2016 - 10:04 AM

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.c...r-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.


  • 0

Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
LiteSpeed Powered - Shared, Reseller, Premium, and VPS
Incremental R1Soft CDP Backups on all shared, semi-dedicated, and VPS services!
http://www.mddhosting.com/- Follow us on Twitter!


#3 MikeDVB

MikeDVB

    Forum Administrator

  • Staff Administrator
  • PipPipPipPipPip
  • 2,561 posts
  • Gender:Male
  • Location:Central Indiana, USA

Posted 04 October 2016 - 10:09 AM

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.


  • 0

Michael Denney - MDDHosting, LLC - Professional Hosting Solutions
LiteSpeed Powered - Shared, Reseller, Premium, and VPS
Incremental R1Soft CDP Backups on all shared, semi-dedicated, and VPS services!
http://www.mddhosting.com/- Follow us on Twitter!


#4 stfual

stfual

    Newbie

  • Members
  • Pip
  • 3 posts
  • Gender:Male

Posted 04 October 2016 - 09:33 PM

Thanks. I'm testing it again today.


  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users