works at command line but not in apache

From: Date: Sat, 17 Mar 2007 20:29:52 +0000
Subject: works at command line but not in apache
Groups: php.general 
Request: Send a blank email to php-general+get-250766@lists.php.net to get a copy of this message
Hi, I have this short php script: [op;ening <?php and closing ?> removed. $db = pg_connect('dbname=bpsimple user=minitwr password=RWHart') ; print $db . "<br />" . "\n" ; if ($db) { print 'Connection attempt succeeded.' . "<br />" . "\n" ; } else { print 'Connection attempt failed.'. "<br />" . "\n" ; } $query = 'SELECT fname, lname FROM customer' ; $result = pg_query($db, $query) ; while($myrow = pg_fetch_assoc($result) ) { print $myrow['fname'] . " " . $myrow['lname'] . "\n" ; } This works fine as a PHP script from the command line, but wrapped up in <html> </html> tags it refuses to connect with the database from within apache. All connections are local host. PHP otherwise works fine on the apache server and the code is identical on both the CL script and the test.php web page. Ideas? Where to start looking? TIA Bob

« previous php.general (#250766) next »