Conectando cakephp 2.0 con PostgreSQL
Estoy usando cakephp 2.0 y un servidor wamp. He habilitado el pdo de postgres en el php e intenté conectarme a Postgres. Sin embargo, todavía dice que hay un error. Mi nombre de usuario y contraseña también se confirman dos veces.
Abajo hay códigos para el archivo database.php:
public $default = array(
'datasource' => 'Database/Postgres',
'persistent' => false,
'host' => 'localhost',
'port' => '5432',
'login' => 'postgres',
'password' => 'password',
'database' => 'Test',
'schema' => '',
'prefix' => '',
'encoding' => ''
);
Incluso probé esto:
public $default = array( 'datasource' => 'Database/Postgres', 'persistent' => false, 'host' => 'localhost', 'port' => '5432', 'login' => 'postgres', 'password' => 'password', 'database' => 'Test', 'schema' => 'public', 'prefix' => '', 'encoding' => '' );
Mi archivo pga_hba.config es:
TYPE DATABASE USER CIDR-ADDRESS METHOD # IPv4 local connections: host all all 127.0.0.1/32 md5 # IPv6 local connections: host all all ::1/128 md5
En C: \ wamp \ bin \ php \ php5.3.9 \ ext
Tengo ambos
php_pdo_pgsql.dll php_pdo_sqlite.dll
Mi archivo de configuración de Postgres es:
listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost', '*' = all # (change requires restart) port = 5432 # (change requires restart) max_connections = 100 # (change requires restart) # Note: Increasing max_connections costs ~400 bytes of shared memory per # connection slot, plus lock space (see max_locks_per_transaction). #superuser_reserved_connections = 3 # (change requires restart) #unix_socket_directory = '' # (change requires restart) #unix_socket_group = '' # (change requires restart) #unix_socket_permissions = 0777 # begin with 0 to use octal notation # (change requires restart) #bonjour_name = '' # defaults to the computer name # (change requires restart)
Compruebo la información de php y todavía descubrí que pgsql no estaba allí. Estoy usando el servidor wamp.
[PostgresSQL] ; Allow or prevent persistent links. ; http://php.net/pgsql.allow-persistent pgsql.allow_persistent = On ; Detect broken persistent links always with pg_pconnect(). ; Auto reset feature requires a little overheads. ; http://php.net/pgsql.auto-reset-persistent pgsql.auto_reset_persistent = Off ; Maximum number of persistent links. -1 means no limit. ; http://php.net/pgsql.max-persistent pgsql.max_persistent = -1 ; Maximum number of links (persistent+non persistent). -1 means no limit. ; http://php.net/pgsql.max-links pgsql.max_links = -1 ; Ignore PostgreSQL backends Notice message or not. ; Notice message logging require a little overheads. ; http://php.net/pgsql.ignore-notice pgsql.ignore_notice = 0 ; Log PostgreSQL backends Noitce message or not. ; Unless pgsql.ignore_notice=0, module cannot log notice message. ; http://php.net/pgsql.log-notice pgsql.log_notice = 0
Ya hice esto en mi archivo php.ini:
extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll extension=php_pgsql.dll