Reputation: 79
I'm working on an application that runs fine with PHP 4 in a windows 8 server. I'm setting a local server with postgres to work locally but with PHP 5 to migrate a few things. I'm having some compatibility issues but nothing big except that the pg_connect function in a class is not working and is not throwing me any error
class basededatos{
var $link_;
function basededatos(){
$this->link_=pg_connect("host=localhost port=5432 dbname=... user=postgres password=...") or die('Falla en la conexión a la Base de Datos. Por favor, Revise la Configuración.');
}
function cerrarconexion(){
pg_close($this->link_);
}
function Abreconexionconretorno($consulta){
$resultado=pg_query($consulta)or die("La consulta falló con error: ".pg_last_error());
return $resultado;
}
function Abreconexionsinretorno($consulta){
pg_query($consulta)or die("La consulta falló con error: ".pg_last_error());
}
}
After this
$this->link_=pg_connect(...)
It just dies, any idea why is this happenning? Thanks
Upvotes: 0
Views: 6317
Reputation: 1209
Probably you don't have PostreSQL extension enabled in php.ini file because You upgraded to PHP 5. Just add this line to php.ini if pgsql module for PHP is installed:
extension=php_pgsql.dll
(windows)
extension=php_pgsql.so
(linux)
If the module is not installed then go with:
sudo apt-get install php5-pgsql
Upvotes: 4