0

I'm trying to work with the codeigniter CMS BONFIRE.I've used codeigniter before, I actually have an installation of both pure codeigniter and bonfire on my local server.First off I've been having trouble with my .htacess files on my xammp server but that's a topic for another day.My Bonfire installation for some reason will not recognize my database settings in application/config/database.php
they are something like

$active_group = 'default';
$active_record = TRUE;

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = '$username';
$db['default']['password'] = '$password';
$db['default']['database'] = 'bonfire';
$db['default']['port']     = '3306';
$db['default']['dbdriver'] = 'mysql';
$db['default']['dbprefix'] = 'bf_';
$db['default']['pconnect'] = FALSE;
$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'] = TRUE;

where $ username is my username and $ password is my password but (obviously i cant show it).
i get this error

A Database Error Occurred
Unable to connect to your database server using the provided settings.

Filename: C:\xampp\htdocs\Bonfire-master\bonfire\codeigniter\database\DB_driver.php

Line Number: 124
3
Contributors
5
Replies
41
Views
2 Years
Discussion Span
Last Post by cereal
0

Seems fine, go to

C:\xampp\htdocs\Bonfire-master\bonfire\codeigniter\database\drivers\mysql\mysql_driver.php

Line 73, method db_connect(), you find:

return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);

change it, temporarly for this issue, to:

return mysql_connect($this->hostname, $this->username, $this->password, TRUE) or die(mysql_error());

And then reload the page, you should see the real error that makes the connection fail.

//EDIT

By the way, in order to complete the setup process in Bonfire, you have to copy the database.php file into the development directory, so copy:

bonfire/application/config/database.php

To:

bonfire/application/config/development/

Just copy, do not move it. Bye!

Edited by cereal

0

Thank you @cereal , no errors are displayed , thank you for suggesting about moving the database.php file to different evironments.However I'm still getting the error.I'm getting frustrated ,I Love codeigniter and bonfire is just like it, I'm about to give up and use pyrocms which is connecting with no errors but I'd prefer not to use a templating engine.

0

You're welcome!

I would try to change the database configuration values, line per line, and verifying if there are some changes. In particular I would focus on these lines:

$active_record = TRUE;

$db['default']['username'] = '$username';
$db['default']['password'] = '$password';

$db['default']['port']     = '3306';

$db['default']['dbdriver'] = 'mysql';

In order: try to set active record to FALSE, be sure that username and password are correctly set, right now with single quotes PHP will send literally $username & $password, not the assigned values, to send those you have to use double quotes:

$db['default']['username'] = "$username";
$db['default']['password'] = "$password";

Or simply remove them:

$db['default']['username'] = $username;
$db['default']['password'] = $password;

Not sure the issue is this, but it could be, at first I thought your was a simple edit to cover your credentials...

Be sure the database is listening port 3306 and that is not served through a local socket.

Regarding the driver, instead, you could try by setting mysqli or pdo and see what it happens.

Edited by cereal

0

@cereal: OP said those are just replaced in this code... I gather... or verbatim, "where $ username is my username and $ password is my password but (obviously i cant show it)" so I'm guessing that's not how it actually is in his code

0

@cilla I believe it also, for this reason I wrote:

at first I thought your was a simple edit to cover your credentials...

since English is not my main language, and being in doubt, I prefer to make an obvious observation. Thanks for the clarification :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.