The Siamerican

Siamese American – Thailand USA port of paralell propagation

« « July 3 Election Posters seen in Phuket| A Decade Goes By in Thailand: Asaha Bucha and Buddhist Lent Weekend » »

IT Woes – Burning Daylight with PHP, MySQL and WordPress upgrades on 1and1 servers

Finally, the Siamerican has been restored to its original state following  a bunch of IT shinanagans which inflicted the Siamerican’s webhosting webspace last week. It all started last week with another website the Siamerican owns which randomly started returning 404 Errors. Not sure if it was related or just coincidence, but when trying to solve this problem corresponding with the support team from the webhosting company, 1and1, another problem surfaced when an email from their abuse team said my webspace has been locked. This caused all my sites to be inaccessible for at least three days.

Long story short, they said my webspace was hacked by spammers and pointed to some spamming scripts planted in one of my directories, telling me  to delete them and upgrade all my wordpress-run sites to the latest version (3.2). So after deleting the scripts,  I proceeded in backing up all my MySQL databases and content files of my websites, and proceded to manually upgrade the wordpress version powering the Siamerican, for starters.

Would have been simple enough to do a wordpress upgrade so I thought, but I soon was faced with yet another brick wall. The latest version of wordpress required MySQL PHP version 5 or higher to work, which the database I was using was version 4.

While this link offers a forced solution by simply adding a line of code to an .htaccess file planted in the website’s root directory allowing me to view the site at minimal, it still didn’t make the outdated PHP4 compatible with the latest version of WordPress (which I think from version 2.9 and up needs PHP5) and thus only gave me an error message when I tried to get to the wordpress administration page.

Long story short, the solution was to create a new MySQL database using PHP version 5, and to manually replace all the database data into the new database, and change my database login details on the wordpress configuration file accordingly.

Finally, this allowed the wordpress upgrade to work! Almost got on with my life…New problem. All the pages on Siamerican which had Thai language characters — a dozen or so — were now displaying the Thai words and sentences throughout the site as unrecognized characters such as ???????????.

After messing around inside MYPHP administration for some hours, I figured that the problem lied in my exported sql database file, as all the Thai characters in the output file were changed into ?????  instead of the original Thai characters อักษรภาษาไทย, thus when I imported the database data into the new PHP5 friendly database, all the ???? were imported instead of original Thai.

I couldn’t figure out how to export the whole database (php4 version) while preserving the Thai language characters in tact cause no matter what box I ticked, Thai became ??? in the output sql file.

However, I found out if I exported only the WP_posts Table instead of the entire database, the Thai characters were in tact in the output file.

The next task was to import the wp_posts data to replace the flawed table (which displayed ??????? instead of อักษรภาษาไทย) and the only way I found to work was to manually copy/paste the entirety of the wp_posts data  into SQL query box for wp_posts, as even browsing and selecting the wp_posts file had no effect.

Voila ! The handful of post which had Thai characters อักษรภาษาไทย were finally displaying normally.

Oh, one more thing, the new php5 version mysql database had “Collation” (something to do with character encoding) in all the tables were set to some Latin German setting by default, and I found out that in order to display Thai correctly, it should be set to be utf8_unicode_ci, which I changed accordingly.

Forgive me if this post is not comprehensively written in a step by step for dummies format as I’m not an IT geek and just spent hours on hours solving this issue.

If you are having similar problems, for Migrating from PHP4 to PHP5 by creating a new database and transferring the old data into the new one, see this blog entry

Also, see this post  for someone else who had a similar problem about Thai characters not showing due to MySQL problem (no solution offered)

And this page covers a similar MySQL database problem about Thai character encoding

 

 

 

Popularity: 4% [?]


« « July 3 Election Posters seen in Phuket
| A Decade Goes By in Thailand: Asaha Bucha and Buddhist Lent Weekend » »

Liked this post? You may also enjoy:

Leave a Reply