Hello,

I am trying to download my online website: gsaconst

offline - and set it to work offline, yet I haven't been successfull.

In my offline website I receive this error message:

--------------------
A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: C:\xampp\htdocs\gsaconst\system\database\DB_driver.php

Line Number: 124

---------------------

I already set the database.php setting to:

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'gsaconst_database';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = 'pix_';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = FALSE;
$db['default']['cachedir'] = '';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

which is the same like localhost host as far as the username, password and hostname.

Please help.

Recommended Answers

All 3 Replies

try changing the config value for the pconnect to FALSE. line 124 is the is argument if pconnect is false then initialize database connection if not the class assumed that a persistent connection exist. By setting it to false, we force the initialize method to execute the db_connect method. I am not sure if XAMPP can handle persistent connection though.

$db['default']['pconnect'] = FALSE;

I adon't know why this is happening in PHP 5.4.19 in xampp and others, but in php 5.5.1 and above I never have this problem.

ok, I try this:

$db['default']['pconnect'] = FALSE;

and I still receive the same errors

this error

Unable to connect to your database server using the provided settings.

is coming from line 124 filename: system/database/DB_driver.php method initialized()

if ( ! $this->conn_id)
    {
        log_message('error', 'Unable to connect to the database');

Can you tell me what is your PHP version?

While you are looking at it, try changing this

$db['default']['hostname'] = 'localhost';

to

$db['default']['hostname'] = '127.0.0.1'; 

Before doing the above, can you make sure that you have the database named **gsaconst_database ** and of course the same tables as your online version.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.