Database config on Codeigniter


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).

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Loganathan NatarajanLAMP DeveloperCommented:
What is the host name given ? did you check with Code Igniter for Pgsql library?
Loganathan NatarajanLAMP DeveloperCommented:
First try some simple script way whether db is connected with hosting ip

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

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

Open in new window

dimensionavAuthor Commented:

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?

Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Loganathan NatarajanLAMP DeveloperCommented:
did you enable this to view the errors?
 ini_set('display_errors', '1');

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Loganathan NatarajanLAMP DeveloperCommented:
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

dimensionavAuthor Commented:

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?

Loganathan NatarajanLAMP DeveloperCommented:
Dido you enabled error reporting?
dimensionavAuthor Commented:

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

Thank you!
Loganathan NatarajanLAMP DeveloperCommented:
I am glad that it helped. All the best
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.