Re: works at command line but not in apache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



rwhartung wrote:
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

well, how about showing us the code that doesn't work also, I know you said it was the same, but what you have here is an incomplete script.

Show us the entire script that you are using from the cli and the web.

Also, give us the error, if any, that you are getting from the web script.

Jim

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux