PHP - Codeigniter - connection to PostgreSQL is not performed

Im pretty new to CodeIgniter, but in the past I developed several work pages. I am trying to reorganize these pages (old pages still work in the Postgres Linux window) and develop them in the Windows window; but I got stuck due to a problem connecting to the Postgres database, and Im got the following error:

Database error occurred

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

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

I know this error occurs when there is no database configuration, but I have a valid database configuration in C: \ Subayogam_v2.0 \ Codeigniter \ application \ config \ database.php. The following are the configuration file details:

$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 path to the cache folder, and also tried a simple PHP page that connects to the same database to see if the drivers are working, and I can see the results from the database. The Apache error log also has no useful error messages. I copied the entire application from the current 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 more error information?

+4
source share
1 answer

I had a similar problem when I first installed codeigniter with postgres. Postgres runs on a different port, so you need to specify the port in the database configuration as such; 5432 was selected by default postgres by default, since I already have mysql installed.

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

+6
source

All Articles