PHP and Postgresql 6.5.1

Started by eric buschelmannover 26 years ago6 messagesgeneral
Jump to latest
#1eric buschelmann
ehbpg@one.net

I downloaded and compiled the most recent version of PHP and Apache.
The PHP module functions properly when parsing commands such as
echo and variable declarations. However when I submit a query through
pg_exec and try to display the results using pg_Fetch_Array, I get
"Document
Contains No Data." I followed the instructions provided by PHP to test
for
segmentation fault and have come to the conclusion that when
PHP attempts
to post the query to the database, it blows up in segmentation fault.

Does PHP work with Postgresql 6.5.1 at this time?

Please reply to this list as well as my personal email account as soon
as possible.

Thank you!

Eric Buschelmann
Systems Analyst
ehb@one.net

#2Dan Wilson
dan_wilson@geocities.com
In reply to: eric buschelmann (#1)
Re: [GENERAL] PHP and Postgresql 6.5.1

I have it running with 6.5, but haven't tried the 6.5.1 yet. Just haven't
got around to upgrading.

-Dan

Show quoted text

Does PHP work with Postgresql 6.5.1 at this time?

#3Jose Miguel Pereira Tavares
mtavares@student.dei.uc.pt
In reply to: eric buschelmann (#1)
Re: [GENERAL] PHP and Postgresql 6.5.1

On Tue, 27 Jul 1999, eric buschelmann wrote:

I downloaded and compiled the most recent version of PHP and Apache.
The PHP module functions properly when parsing commands such as
echo and variable declarations. However when I submit a query through
pg_exec and try to display the results using pg_Fetch_Array, I get
"Document
Contains No Data." I followed the instructions provided by PHP to test
for
segmentation fault and have come to the conclusion that when
PHP attempts
to post the query to the database, it blows up in segmentation fault.

I have the same problem, but found out that using pg_fetch_row works
quite well.

Does PHP work with Postgresql 6.5.1 at this time?

I wonder if it's a PHP or PostgreSQL problem, as PostgresSQL seems to
be doing just fine (there seems to be no problems with other clients like psql
or kpsql)

-------------------- Jose Miguel Pereira Tavares --------------------

Talking much about oneself can also be a means to conceal oneself.
-- Friedrich Nietzsche

In reply to: Jose Miguel Pereira Tavares (#3)
Re: [GENERAL] PHP and Postgresql 6.5.1

I downloaded a function called ShowResults from a link I found on
www.php.net... It seems to work just fine.

Thank you for your help and prompt response.

Eric Buschelmann

On Tue, 27 Jul 1999, Jose Miguel Pereira Tavares wrote:

Show quoted text

On Tue, 27 Jul 1999, eric buschelmann wrote:

I downloaded and compiled the most recent version of PHP and Apache.
The PHP module functions properly when parsing commands such as
echo and variable declarations. However when I submit a query through
pg_exec and try to display the results using pg_Fetch_Array, I get
"Document
Contains No Data." I followed the instructions provided by PHP to test
for
segmentation fault and have come to the conclusion that when
PHP attempts
to post the query to the database, it blows up in segmentation fault.

I have the same problem, but found out that using pg_fetch_row works
quite well.

Does PHP work with Postgresql 6.5.1 at this time?

I wonder if it's a PHP or PostgreSQL problem, as PostgresSQL seems to
be doing just fine (there seems to be no problems with other clients like psql
or kpsql)

-------------------- Jose Miguel Pereira Tavares --------------------

Talking much about oneself can also be a means to conceal oneself.
-- Friedrich Nietzsche

In reply to: eric buschelmann (#1)
Re: [GENERAL] PHP and Postgresql 6.5.1

On July 26. 1999 at 20:52 eric buschelmann wrote about [GENERAL]
PHP and Postgresql 6.5.1:

I downloaded and compiled the most recent version of PHP and Apache.
The PHP module functions properly when parsing commands such as echo
and variable declarations. However when I submit a query through
pg_exec and try to display the results using pg_Fetch_Array, I get
"Document Contains No Data." I followed the instructions provided
by PHP to test for segmentation fault and have come to the
conclusion that when PHP attempts to post the query to the database,
it blows up in segmentation fault.

Does PHP work with Postgresql 6.5.1 at this time?

I've tried both 6.5 and 6.5.1 and none of them seems to work with
pg_Fetch_Array(), though pg_Fetch_Row() is working okay, also
pg_Fetch_Array DOES actually work as long as you only return single
columns, it is actually possible to have a "SELECT col1 from mytable"
in the pg_Exec() call, and then use fetch_array() to get the result.
Also pg_Fetch_Object() has exactly the same problem; multible columns
make the system (postmaster) return a:
pg_recvbuf: unexpected EOF on client connection

To be exact, the pg_Exec() call does NOT make the system blow up in
itself, it's first when you try a pg_Fetch_Array() or
pg_Fetch_Object() call that the system "surrenders" (have tried
Exec'ing without Fetching).

Yours faithfully.
Finn Kettner.

#6Noname
ghoffman@ucsd.edu
In reply to: Finn Kettner (#5)
Re: [GENERAL] PHP and Postgresql 6.5.1

Eric,
I've got my PHP running fine with PostGreSQL inthe past couple of weeks.
Here is a page that pulls out current members from my club roster and
displays some directory information in a table. I'm kinda proud of the
recursive (ir is it re-iterative?) sections. (Page edited to delete
impertinent identifying data.)
Don't forget to grant the Apache server (user www) select access to your
database or explicitly log in with a valid PostGreSQL user name.
Cheers,
Gary
----------------
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 3.2//EN\">

<HTML><HEAD><TITLE>CGSSD Member Directory</TITLE></HEAD><BODY
TEXT="#000000" BGCOLOR="#E7E7EF" LINK="#0000EE" VLINK="#551A8B"
ALINK="#FF0000">

<H1 ALIGN=CENTER>Member Directory</H1>

<font size=4>CGSSD membership information is current as of June 1999. This
directory is for the non-commercial use of its members only. Any other use
is <u>prohibited</u>.<p>

<p>Please wait for directory to load.<br>

<?php
flush();
if (!$conn = pg_Connect("","","","","cgssd_members")){
echo "Error! Can't connect to database.";
exit;
}

$query = "select * from memdir4 where status = 'A' order by lower(lname),
lower(fname)";

if (!$result = pg_exec($conn, $query)){
echo "Error while processing query.<br>";
pg_close($conn);
exit;
}

$rows = pg_NumRows($result);

echo "$rows members in directory!\n";

# the non-breaking space is the best way I could find to control column
widths
echo "<p><p><table border=1 cellpadding=3><tr><th
width=200>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;</th>\n";
echo "<th width=80>Phone</th><th
width=30>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Program&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th><th
width=100>E-Mail Address</th><th>Web Page</th></tr><p>\n";

for ($j=0; $j < $rows; $j++) {

$member = pg_result($result, $j, 0) . ", " . pg_result($result, $j, 1);

echo "<tr><td>" . $member . "</td>\n";

if (!pg_result($result, $j, 2) or !pg_result($result, $j, 3) or
!pg_result($result, $j, 4)) {
echo "<td>&nbsp;</td>";
}
else {
echo "<td>" . pg_result($result, $j, 2) . "-" . pg_result($result, $j, 3)
."-" . pg_result($result, $j, 4) ."</td>\n";
}

if (!pg_result($result, $j, 5)) {
echo "<td>&nbsp;</td>";
}
else {
echo "<td>" . pg_result($result, $j, 5) . "</td>\n";
}

if (!pg_result($result, $j, 6)) {
echo "<td>&nbsp;</td>";
}
else {
echo "<td><a href=mailto:\"" . pg_result($result, $j, 6) . "\">" .
pg_result($result, $j, 6) ."</a></td>\n";
}

if (!pg_result($result, $j, 7)) {
echo "<td>&nbsp;</td>";
}
else {
echo "<td><a href=http://\&quot;&quot; . pg_result($result, $j, 7) . "\">" .
pg_result($result, $j, 7) ."</a></td>\n";
}
}
echo "</tr></table>";
?>

</body></HTML>
---------------------

ehb@one.net writes:

I downloaded and compiled the most recent version of PHP and Apache.
The PHP module functions properly when parsing commands such as
echo and variable declarations. However when I submit a query through
pg_exec and try to display the results using pg_Fetch_Array, I get
"Document
Contains No Data." I followed the instructions provided by PHP to test
for
segmentation fault and have come to the conclusion that when
PHP attempts
to post the query to the database, it blows up in segmentation fault.

Does PHP work with Postgresql 6.5.1 at this time?

Please reply to this list as well as my personal email account as soon
as possible.

Thank you!

Eric Buschelmann
Systems Analyst
ehb@one.net

**************************************************************************
* Gary B. Hoffman, Computing Services Manager e-mail: ghoffman@ucsd.edu *
* Graduate School of International Relations and Pacific Studies (IR/PS) *
* University of California, San Diego (UCSD) voice: (858) 534-1989 *
* 9500 Gilman Dr., La Jolla, CA 92093-0519 USA fax: (858) 534-3939 *
**************************************************************************