Solved

Database config on Codeigniter

Posted on 2014-09-24
9
287 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
Comment Utility
What is the host name given ? did you check with Code Igniter for Pgsql library?
0
 
LVL 36

Expert Comment

by:Loganathan Natarajan
Comment Utility
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
Comment Utility
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
 
LVL 36

Accepted Solution

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

Open in new window

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 36

Expert Comment

by:Loganathan Natarajan
Comment Utility
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
Comment Utility
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
Comment Utility
Dido you enabled error reporting?
0
 

Author Comment

by:dimensionav
Comment Utility
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
Comment Utility
I am glad that it helped. All the best
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now