4

I’m pretty new to CodeIgniter, but I have developed a few working pages in the past. I’m trying to refactor those pages (the old pages are still running in a Linux box on Postgres) and developing them in a Windows box; but I’m stuck with a Postgres database connectivity issue and I’m getting the following error:

A Database Error Occurred

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

Filename: C:\Subayogam_v2.0\Codeigniter\system\database\DB_driver.php
Line Number: 124

I know that this error comes up when the database configuration is missing, but I do have a valid DB configuration at C:\Subayogam_v2.0\Codeigniter\application\config\database.php. Given below is the config file data:

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

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'mypassword';
$db['default']['database'] = 'subayogam_v2.0';
$db['default']['dbdriver'] = 'postgre';
$db['default']['dbprefix'] = '';
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = TRUE;
$db['default']['cache_on'] = TRUE;
/*$db['default']['cachedir'] = '/var/subayogam_2.0/cache';*/
$db['default']['cachedir'] = 'C:\Subayogam_v2.0\Codeigniter\cache';
$db['default']['char_set'] = 'utf8';
$db['default']['dbcollat'] = 'utf8_general_ci';
$db['default']['swap_pre'] = '';
$db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;

I double checked the cache folder path and also tried a simple PHP page that connects to the same DB to see if the drivers are working, and I’m able to see results from the database. No useful error messages in Apache error log either. I've copy pasted the entire application from the running version and modified the DB file to point to the new database. Nothing else has changed.

What could be wrong? Is there any specific log file that can provide me with more information on the error?

5
  • is the db_driver really postgre not postgres or postgresql? twitch Commented Aug 31, 2012 at 12:17
  • 1
    It's postgre. I have a working version on the Linux box which uses posgre. Commented Aug 31, 2012 at 17:05
  • Have you looked in the Windows event viewer? Done a search for file inside C:\Subayogam_v2.0\Codeigniter modified in the last hour (after running a test)? I'd even try Process Monitor to see if I could find where the codeigniter executable was writing to, see if I could spot any logs. Commented Sep 2, 2012 at 11:57
  • I discarded the application and built it again from scratch with pretty much the same settings and it worked fine. I didn't find any errors logged anywhere! :( Thanks for your help anyway! :) Commented Sep 19, 2012 at 18:10
  • Glad to hear it. Please post that as your own answer and accept it. Commented Sep 19, 2012 at 23:06

1 Answer 1

6

I've had a similar problem when i first setup codeigniter with postgres. Postgres runs on a different port, so you'll need specify the port in the database configuration as such; 5432 was the default port postgres chose since i already had mysql installed.

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.