Solved

Database config on Codeigniter

Posted on 2014-09-24
9
300 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
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…
The viewer will learn how to count occurrences of each item in an array.

816 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

9 Experts available now in Live!

Get 1:1 Help Now