[opensuse] php and postgres 9.3 vs 10.3
Hello, I have a SuSE 9.3 system with a postgres database and a php web app that connects to the datbase. This works fine. I also have SuSE 10.3 but cannot get php to connect to the database. 9.3 versions: PHP 4.3.10 postgres (PostgreSQL) 8.0.13 10.3 vesions: PHP 5.2.6 with Suhosin-Patch 0.9.6.2 postgres (PostgreSQL) 8.2.6 Both have identical pg_hba.conf files. Database was transferred as recommended using "pg_dumpall -f > SAVE" as user postgres on 9.3 system and "psql template1 -f SAVE" as user postgres on 10.3 system The php code that is failing is: $dbh=&$_SESSION['dbh']; $cstring="dbname=$db_name host=localhost user=$user password=$password"; $dbh=pg_connect($cstring) or die("Could not connect to postgresql database $db_name"); Any clues? Thanks, Bob -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Robert Paulsen escribió:
The php code that is failing is:
$dbh=&$_SESSION['dbh']; $cstring="dbname=$db_name host=localhost user=$user password=$password"; $dbh=pg_connect($cstring) or die("Could not connect to postgresql database $db_name");
Any clues?
Did you enabled error reporting ? set display_errors=On in php.ini ps: that piece of code, does not make sense...first $dbh is assigned to be a reference of $_SESSION['dbh'] (which is a real hack, what you want seems to be the "singleton pattern" instead) but a line later it is reasigned by value to be a postgresql resource.. no wonder if there is other bug around... -- "We have art in order not to die of the truth" - Friedrich Nietzsche Cristian Rodríguez R. Software Developer Platform/OpenSUSE - Core Services SUSE LINUX Products GmbH Research & Development http://www.opensuse.org/
On Monday 26 January 2009 1:00 pm, Cristian Rodríguez wrote:
Robert Paulsen escribió:
The php code that is failing is:
$dbh=&$_SESSION['dbh']; $cstring="dbname=$db_name host=localhost user=$user password=$password"; $dbh=pg_connect($cstring) or die("Could not connect to postgresql database $db_name");
Any clues?
Did you enabled error reporting ? set display_errors=On in php.ini
ps: that piece of code, does not make sense...first $dbh is assigned to be a reference of $_SESSION['dbh'] (which is a real hack, what you want seems to be the "singleton pattern" instead) but a line later it is reasigned by value to be a postgresql resource.. no wonder if there is other bug around...
Thanks -- got some clues to track down using display_error=On. Seems my php code (written for php v4) does not please php5. This is old code from one of my first php projects. Looks like it will need some cleanup. Thanks, Bob -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Cristian Rodríguez
-
Robert Paulsen