Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Configuring a PHP Framework on Linux

Tags:

linux

php

pdo

I'm running through the tutorial for TinyMVC on a Linux machine.

Everything was working fine until I got to the models page:

As soon as I did the "Learn by Example" step, I got this error:

Error: 0
Message: Can't connect to PDO database 'mysql'. Error: SQLSTATE[HY000] [2019] Can't initialize character set UTF-8 (path: /usr/share/mysql/charsets/)
File: /data/utilities/tinymvc/sysfiles/plugins/tinymvc_pdo.php
Line: 107

I'm using PHP5 and PDO is installed and compiled (TinyMVC throws an error if it is not). If I change the charset to something else (like UTF8 or latin1), it gets around this error, but then there is another error in the sysfiles that I'm not supposed to have to edit to get TinyMVC working. There is no UTF-8.xml file in /usr/share/mysql/charsets/, but something I read suggested that there shouldn't be.

Any thoughts on what the problem is?

like image 521
T. Brian Jones Avatar asked Nov 05 '22 17:11

T. Brian Jones


1 Answers

Since the default character set on most MySQL databases is latin1, I tried adding the following line to the database configuration file tinymvc/configs/database.php

$config['default']['charset'] = 'utf8'; // changed from UTF-8

This seems to have fixed the problem.

like image 196
T. Brian Jones Avatar answered Nov 09 '22 07:11

T. Brian Jones