Solved

Database config on Codeigniter

Posted on 2014-09-24
9
315 Views
Last Modified: 2014-09-27
Hi,

I'm trying to connect to a database server that has a static IP.
If you do it with pgsql3 software works fine, but it doesn't work if you try with the Codeigniter database library.
It doesn't shows any errors, only a white page on everything that is on the same controller (the one which I'm using for the database connection).

Regards!
0
Comment
Question by:dimensionav
  • 6
  • 3
9 Comments
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 40343691
What is the host name given ? did you check with Code Igniter for Pgsql library?
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 40343693
First try some simple script way whether db is connected with hosting ip
<?php

$dbconn = pg_connect("host=sheep port=5432 dbname=mary user=lamb password=foo");

if (!$dbconn) {
  echo "An error occurred.\n";
  exit;
}

Open in new window

0
 

Author Comment

by:dimensionav
ID: 40345098
Hi

I've tried with the simple php connection and it worked (the one you used above). In my Codeigniter there's a library for postgres and i got no errors for that.

Is there anything else that I should check?

Regards!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 36

Accepted Solution

by:
Loganathan Natarajan earned 500 total points
ID: 40345394
did you enable this to view the errors?
 ini_set('display_errors', '1');
error_reporting(E_ALL); 

Open in new window

0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 40345395
Have you set up like this in your config.php and check u have driver on database folder ?

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'postgres';
$db['default']['password'] = 'postgres';
$db['default']['database'] = 'abc_gis';
$db['default']['dbdriver'] = 'postgre';
$db['default']['dbprefix'] = '';
$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;
$db['default']['port'] = 5432;
About these ads

Open in new window

0
 

Author Comment

by:dimensionav
ID: 40346159
Hi,

My connection has the same options that the one you used above, with the exception that my Database is in a remote server (not localhost). Is there any other thing that I should check?

Regards
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 40346250
Dido you enabled error reporting?
0
 

Author Comment

by:dimensionav
ID: 40348143
Hi!

Thanks, with the ini_set I got the error and fixed it!
I was only using the error_reporting(E_ALL);

Thank you!
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 40348271
I am glad that it helped. All the best
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
I'd like to talk about something that is near and dear to my heart: build systems. Without them, building software is all about compiling locally, with software versions everywhere. It can be a mess. Today we are going to discuss building a small di…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Steps to create a PostgreSQL RDS instance in the Amazon cloud. We will cover some of the default settings and show how to connect to the instance once it is up and running.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question