[pgsql-jp: 26834] デバッグのしかた
中村美紀男
nmkamdrr @ mail.magical2.egg.or.jp
2002年 7月 28日 (日) 12:12:18 JST
みなさん、こんにちは。
はじめて参加させていただきます。
PostgreSQL + PHP + Apache について教えてください。
このたび TurboLinux8.0workstation で
・PostgreSQL-7.2.1 ...FTPサイトからTarボールを取得
ソースからコンパイル
・PHP-4.1.2-4 ...Turboに入っていた rpm 。
・Apache-1.3.23-3 ...Turboに入っていた rpm 。
という環境なのですが、次のような php を実行しても
エラーになってしまうのです。
<html>
<body>
<?php
echo "<h1>Apache + PHP + PostgreSQL TEST</h1><br>";
$con = pg_connect ("dbname=test user=postgres");
$result = pg_exec($con,"select * from shinamono");
$rows = pg_numrows($result);
echo "<table border=1>";
echo "<tr><td>品名</td><td>値段</td></tr>";
for ($i=0; $i<$rows; $i++) {
$field = pg_fetch_array($result,$i);
echo "<tr>";
echo "<td>" . $field["品名"] . "</td>";
echo "<td>" . $field["値段"] . "</td>";
echo "</tr>";
}
?>
</table>
</body>
</html>
ブラウザに表示されるエラーメッセージ
Fatal error: Call to undefined function: pg_connect() in
/var/www/html/sample.php on line 6
こういう場合、どうやってデバッグしたらいいのでしょうか。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ターミナルから、
psql -l
List of databases
Name | Owner | Encoding
-----------+----------+----------
template0 | postgres | EUC_JP
template1 | postgres | EUC_JP
test | postgres | EUC_JP
となりますし、
psql test
test=# select * from shinamono;
hinmei | nedan
--------+-------
みかん | 100
りんご | 150
メロン | 5000
(3 rows)
test=#
となるので、PostgreSQLは動いていると思うのですが...。
中村美紀男
pgsql-jp メーリングリストの案内