I'm having a problem with a php script when connecting to a postgresql
database.  The problem is this:  When Apache runs the php script, the
output is missing everything after my first call to pg_connect().  i.e., I
can "echo", "print" whatever I like, but everything is cut off after that
call--it doesn't show up in the output when run by Apache  However. 
if I pass the script through php manually, I get the expected output.  
For instance, here's the code:

<title>PHP Test</title>

import_request_variables('p', 'p_');

$conn_string = "dbname=PilotProjects user=web-user password=secret";
        print "<p>";
        echo "Point 1"; 
        echo "</p>";
        print "fubar";
   $database = pg_connect ($conn_string)
        or die ("No connection to the database. Error: " . pg_last_error());
   echo "Point1.5\n";
   echo "<p>";
   echo pg_dbname($database); 
   echo "</p>";
   echo get_resource_type($database);
  echo "Point 2\n";

  $result=pg_query ($database, "SELECT \"ProjectName\" FROM

  $resultprintme = pg_fetch_row($result,0)
        or die ("Help! no query result. Error: " .pg_last_error() . "\n");

  echo $resultprintme[0] . "\n";
  /* foreach ($resultprintme as $ProjectName) {
        print ("$ProjectName\n");       
   pg_close ($database);


When Apache runs the script through php, here's the output:

<title>PHP Test</title>

However, when I run the code through php from the command line, the output
is this:

[EMAIL PROTECTED]:~/htdocs/tests/php$ php ./selectStudy1.php
Content-type: text/html
X-Powered-By: PHP/4.3.0

<title>PHP Test</title>
<p>Point 1</p>fubarPoint1.5
<p>PilotProjects</p>pgsql linkPoint 2
Brown County


Which is what I expected.

Can anyone help me with this?  Is this a problem with Apache? With php? With

Any help will be greatly appreciated!



My configuration:

Slackware Linux w / 2.4.18 kernel


[EMAIL PROTECTED]:/etc/apache# httpd -V
Server version: Apache/1.3.26 (Unix)
Server built:   Jun 19 2002 05:51:45
Server's Module Magic Number: 19990320:13
Server compiled with....
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="/var/run/httpd.scoreboard"
 -D DEFAULT_LOCKFILE="/var/run/httpd.lock"
 -D DEFAULT_ERRORLOG="/var/log/apache/error_log"
 -D TYPES_CONFIG_FILE="/etc/apache/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache/httpd.conf"
 -D ACCESS_CONFIG_FILE="/etc/apache/access.conf"
 -D RESOURCE_CONFIG_FILE="/etc/apache/srm.conf"

[EMAIL PROTECTED]:/etc/apache# php -v
PHP 4.3.0 (cgi), Copyright (c) 1997-2002 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2002 Zend Technologies

David W. Brunberg
Engineering Supervisor - Field Process
The F.B. Leopold Company, Inc.
227 South Division Street
Zelienople PA 16063
(724) 452-6300

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

Reply via email to