TAN と、言います。
家庭内のLANでLinuxマシンでVine Linux 2.5(FTP版)を使っています。
php-4.2.3.tar.bz2 をインストールしてDBへのアクセスを試みて
いるのですが、DBへのアクセスができずにいます。
関連するのかどうかわかりませんが、チュトリアルにあるC言語での
サーバー接続は問題なくできています。
何かヒントでも結構ですので、宜しくお願いします。
http : //venus/~yoshiaki/test.php の実行結果
Warning: pg_connect() unable to connect to PostgreSQL server:
could not connect to server: Connection refused Is the server
running on host venus and accepting TCP/IP connections on port
5432? in /home/yoshiaki/public_html/test.php on line 2
/home/yoshiaki/public_html/test.php の内容
<?php
$conn=pg_Connect("host=venus dbname=yoshiaki port=5432");
?>
ls -a /tmp の内容
.X11-unix .font-unix .iroha_unix .ki2-unix .kon1
.kon2 .ppxp-tap0 .rnd .s.PGSQL.5432 .s.PGSQL.5432.lock
.w3m .webmin X-Test.log XF86Config.test fstab.0HGQzU
fstab.fn8D0r install.log install.log.syslog jd_sockV4
/etc/hosts の内容
127.0.0.1 localhost.localdomain localhost
192.168.1.19 venus.local venus
PHP-4.2.3.tar.bz2 のインストールパラメータ
./configure --with-apxs --with-pgsql
make
su
make install
<? phpinfo(); ?> で表示される pgsql 関連の内容
Active Persistent Links 0
Active Links 0
pgsql.allow_persistent on on
pgsql.auto_reset_persistent off off
pgsql.max_links unlimited unlimited
pgsql.max_persistent unlimited unlimited
/var/lib/pgsql/data/pg_hba.confの内容
#TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE
local all trust
host all 127.0.0.1 255.255.255.255 trust
host all 0.0.0.0 0.0.0.0 trust
user nobody の作成
[yoshiaki@venus yoshiaki]$ su
Password: xxxxxxxx
[root@venus yoshiaki]# su postgres
bash-2.04$ createuser nobody
Shall the new user be allowed to create databases? (y/n) n
Shall the new user be allowed to create more new users? (y/n) n
ERROR: CREATE USER: user name "nobody" already exists
createuser: creation of user "nobody" failed <=2回目なので
bash-2.04$
yoshiaki=# \l
データベース一覧
名前 | 所有者 | エンコーディング
-----------+----------+------------------
template0 | postgres | EUC_JP
template1 | postgres | EUC_JP
yoshiaki | yoshiaki | EUC_JP
(3 行)