I have this db configuration in local development environment
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = ''; //Actual username is put inside these quotes
$db['default']['password'] = '';
$db['default']['database'] = ''; //Actual name of database is put inside quotes
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = APPPATH .'cache';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
When I port this to the production server, it does not work, so I tried a lot of things, but one thing that seemed to workwas supposed to change dbdriver to mysqli instead of MySQL. But I also had to put db_debug in FALSE (so it "worked" would not be a valid statement)
I read a lot about this, but I have not found an answer anywhere. (I'm not happy: "Change to debug = false, and it will work")
I wanted to see what the actual problem is, so I also changed the local server to the mysqli driver and then got the error:
A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: C:\Program Files\wamp\www\mellomgarden2\system\database\DB_driver.php
Line Number: 124
After some digging, I see that db_connect () and db_pconnect () work exactly the same way:
- /database/drivers/mysqli/mysqli _driver.php - ,
connect() pconnect() , pconnect() connect().
$db['default']['pconnect'] = TRUE; mysqli.
function db_connect()
{
if ($this->port != '')
{
return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database, $this->port);
}
else
{
return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database);
}
}
function db_pconnect()
{
return $this->db_connect();
}
db_connect() db_pconnect() - erorrs . @ , :
:
: mysqli_connect(): (08004/1040):
: mysqli/mysqli_driver.php
: 76
, db_pconnect mysqli :
function db_pconnect()
{
$this->hostname = 'p:' . ltrim($this->hostname, 'p:');
return $this->db_connect();
}
CodeIgniter - ?