CodeIgniter Forums
Strange problem when connecting to external host using PDO - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forum-6.html)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forum-17.html)
+--- Thread: Strange problem when connecting to external host using PDO (/thread-74844.html)



Strange problem when connecting to external host using PDO - Danielcik - 11-14-2019

Hi!

I have a big problem with my website. When I try to connect it to an external host, it gives me a strange error: 

PHP Code:
Severityerror --> ExceptionCall to a member function errorInfo() on bool /home/qtbflcqc/panel.unitchamp.ro/system/database/drivers/pdo/pdo_driver.php 295
 Unable to connect to the database 

When I try to connect to the database from my localhost, it works fine, without any problem. 

So, when I try to place the website on my PC, and connect it to the external host, it works perfect , no problem, no errors, but when I try to connect to it from the website (which is hosted), it gives me that error.

I set the Remote Acces from the external host, so there should be no problems.

Here is my database.php

PHP Code:
$active_group 'default';
$query_builder TRUE;

$db['default'] = array(
    
'dsn'   => 'mysql:host=188.x.x.x; dbname=name; charset=utf8;',
    
'hostname' => '188.x.x.x',
    
'username' => 'nameuser',
    
'password' => 'pass',
    
'database' => 'name',
    
'dbdriver' => 'pdo',
    
'dbprefix' => '',
    
'pconnect' => FALSE,
    
'db_debug' => FALSE,
    
'cache_on' => FALSE,
    
'cachedir' => 'application/cache/',
    
'char_set' => 'utf8',
    
'dbcollat' => 'utf8_general_ci',
    
'swap_pre' => '',
    
'encrypt' => FALSE,
    
'compress' => FALSE,
    
'stricton' => FALSE,
    
'failover' => array(),
    
'save_queries' => TRUE
); 

Thans a lot!