|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-05-21 18:17 UTC] jah at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Fri Jan 02 16:00:01 2026 UTC |
When pg_connect is opens a connections that is then closed and pg_connect is called again to open a connection again important environment variables like PG_DATESTYLE are cleared and the last connection is set as if that variable was not set. Try this script to replicate the problem. It doesn't happen at least in PHP 3.0.14. <? Function Connect(&$error) { if(!function_exists("pg_connect")) { $error="PostgreSQL support is not available in this PHP configuration"; return(0); } Putenv("PGUSER=root"); Putenv("PGPASSWORD="); Putenv("PGDATESTYLE=ISO"); $connection=pg_connect("","","template1"); echo "$connection \"".getenv("PGDATESTYLE"),"\" \"".getenv("PGUSER"),"\"\n"; if(($connection)>0) return($connection); $error=(IsSet($php_errormsg) ? $php_errormsg : "Could not connect to PostgreSQL server"); return(0); } $error=""; if(($connection=Connect(&$error))) { pg_Close($connection); if($connection=Connect(&$error)) pg_Close($connection); } if(strcmp($error,"")) echo "Error: $error\n"; ?>