Codeigniter 3.1.9 - Connection with the Database

1

I'm developing a Web application using version 3.1.9 of Codeigniter , but I'm having trouble connecting to the database.

Follow configuration:

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'   => 'mysql:host=localhost; port=3306; dbname=tarifador; charset=utf8',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '******',
    'database' => 'tarifador',
    'dbdriver' => 'pdo',
    'dbprefix' => '',
    'pconnect' => FALSE,
    'db_debug' => (ENVIRONMENT !== 'production'),
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array(),
    'save_queries' => TRUE
);

Error presented:

A PHP Error was encountered
Severity: Warning
Message: PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers
Filename: pdo/pdo_driver.php
Line Number: 136
Backtrace:
File: C:\xampp\htdocs\index.php
Line: 315
Function: require_once
A Database Error Occurred
SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers
Filename: C:/xampp/htdocs/system/database/drivers/pdo/pdo_driver.php
Line Number: 142

In the database Schema is already set to UTF8 e UT8_general_ci .

I've also tried using the mysqli driver.

Additional details: PHP version: 5.6.37 MySQL Version: 8.0.12

Thanks to anyone who can help

    
asked by anonymous 04.09.2018 / 18:03

1 answer

0

As I understand in this issue of PHP MySQL 8 has as charset default utf8mb4 and according to the last comment these problems have been fixed in PHP 7.

  

[2018-05-02 17:37 UTC] macleo at outlook dot com

     

Should be fixed as of 7.0.19, 7.1.5, and 7.2.0. Anyone confirm? - yes

Since PHP 5.x does not recognize this charset, the most likely solution is that your tables should be changed to utf8 charset.

    
04.09.2018 / 19:56