Monday, May 27, 2013

Codeigniter configuration for PostgreSQL Database

https://www.youtube.com/watch?v=fIu4TGBvZYo

 

First enable Postgresql extension in php.ini
extension=php_pgsql.dll

You also can enable Postgresql extension for PDO as well.
extension=php_pdo_pgsql.dll

If you forgot to enable this you may come across following error.
A PHP Error was encountered

Severity: Warning

Message: require_once(C:/www/system/database/drivers/postgres/postgres_driver.php) [function.require-once]: failed to open stream: No such file or directory

Filename: database/DB.php

Line Number: 138

Now opendatabase configuration file. You should enter correct settings for connecting with your PostgreSQL database here.
Sample config file.

[sourcecode language="php"]
$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;
[/sourcecode]

1 comment:

  1. It is still show the error like

    A Database Error Occurred

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

    Filename: core/Loader.php

    Line Number: 346

    ReplyDelete

How to enable CORS in Laravel 5

https://www.youtube.com/watch?v=PozYTvmgcVE 1. Add middleware php artisan make:middleware Cors return $next($request) ->header('Acces...