RE: PHP / Apache -- output truncated after pg_connect() call

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

 



For any who may be interested:  

I fixed the problem, noted below, myself.  Evidently the Slackware
PHP/Apache binary is somewhat broken. It worked after I rebuilt PHP with
"configure --with-axps  --with-pgsql"
Apache did not require a rebuild.

dwb

> -----Original Message-----
> From: Dave Brunberg [mailto:DBrunberg@FBLEOPOLD.com]
> Sent: Friday, March 28, 2003 1:30 PM
> To: 'php-db@lists.php.net'
> Subject:  PHP / Apache -- output truncated after pg_connect()
> call
> 
> 
> 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:
> 
> <html>
> <head>
> <title>PHP Test</title>
> </head>
> <body>
> <?php
> 
> 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
> \"ProjectsTable\"");
> 
>   $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);
> ?>
> 
> </body>
> </html>
> 
> When Apache runs the script through php, here's the output:
> 
> <html>
> <head>
> <title>PHP Test</title>
> </head>
> <body>
> <p></p>fubar
> 
> 
> However, when I run the code through php from the command 
> line, the output
> is this:
> 
> dbrunber@galadriel:~/htdocs/tests/php$ php ./selectStudy1.php
> Content-type: text/html
> X-Powered-By: PHP/4.3.0
> 
> 
> <html>
> <head>
> <title>PHP Test</title>
> </head>
> <body>
> <p>Point 1</p>fubarPoint1.5
> <p>PilotProjects</p>pgsql linkPoint 2
> Brown County
> 
> </body>
> </html>
> 
> Which is what I expected.
> 
> Can anyone help me with this?  Is this a problem with Apache? 
> With php? With
> something 
> else?
> 
> Any help will be greatly appreciated!
> 
> dwb
> 
> ===
> 
> My configuration:
> 
> Slackware Linux w / 2.4.18 kernel
> 
> Apache:
> 
> root@galadriel:/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 EAPI
>  -D HAVE_MMAP
>  -D HAVE_SHMGET
>  -D USE_SHMGET_SCOREBOARD
>  -D USE_MMAP_FILES
>  -D HAVE_FCNTL_SERIALIZED_ACCEPT
>  -D HAVE_SYSVSEM_SERIALIZED_ACCEPT
>  -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>  -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"
> 
> php:
> root@galadriel:/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
> 

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux