入口
pkgsrc による設置
  php3
    php3-i18n
    database/php3-pgsql
    www/ap-php3
apache 版
postgres (1)
  php4-pgsql (3)
    make install
php4 (apache1)
  www/php4(2)
    php4 の版
  www/ap-php4(5)
  www/apache(4)
    IPv6
    IPv4+nossl
    Apache/SSL
php4(apache2) - 依存関係
  ap2-php4
    php4
    mod_php4.so
    /usr/pkg/etc/php.ini
  php4-session(6)
    session.so
    --enable-session
    core_globals
    map
    php4 i18n 無
    php4 i18n
  configure
セッション管理
  php3 互換モード
  php4 内蔵
  php4 + phplib
  phpinfo()
PostgreSQL 準備
  postmaster
  環境変数
  initdb
    実際の様子
    試しに起動
  postmaster 設定
  postgreql.conf
  pg_hba.conf
  postmaster の起動
  使用者登録
  pg_ctl
  /etc/rc.conf
  shutdown
データべースを作る
psql
  psql \h
  psql \?
  psql \h select
  psql \d
  psql \copy
  psql 操作
  Data Type
    DATE
Application
  pgpost
    pgpost 設置例
    psql で見る
  AuthPG
      create table
        GRANT
  pgimage
  pgimage psql
SQL
URL
  PostgreSQL
  PHP
良くある問題
    undefined pg_connect()
    Link-ID == false
    Call-time pass-by-reference
    session_register
    Undefined session_adapt_flush
    Failed opening for inclusion
  does not exist in ..
  pg_exec() query failed
  Undefined property: Port
  undefined function: preg_match()
  used in non-rule query
その他
適用例
  日記から等

PostgreSQL + Apache + PHP4 | PHP4 programming

AuthPG

PostgreSQL にパスワードを覚えさせておき、 それを使って apache の userid/password の認証を させるしくみ。2007/08 現在 pkgsrc には三種類が登録されている
Dec 28  2006 www/ap-auth-pgsql/Makefile       mod_auth_pgsql-0.9.12 	ap13-auth-pgsql-0.9.12
Mar 22 04:44 www/ap-auth-postgresql/Makefile  AuthPG-1.4		ap13-auth-postgresql-1.4
Dec 28  2006 www/ap2-auth-pgsql/Makefile      mod_auth_pgsql-2.0.3	ap2-auth-pgsql-2.0.3
Apache-2 の場合、最後の www/ap2-auth-pgsql で make package すれば良い。
PostgreSQL で Apache のユーザ認証
http://www.hizlab.net/app/apachepgsql.html
source.forge
http://authpg.sourceforge.net/
NetBSD/pkgsrc/www/ap-auth-postgresql/
www/ap-auth-postgresql/README.html
AuthPG-1.2b .. NetBSD/pkgsrc
AuthPG-1.3  .. soureforge.net
AuthPG-2.0  .. patch exist.
adding one line for http.conf:
 # LoadModule foo_module modules/mod_foo.so
 #
 LoadModule php4_module lib/httpd/mod_php4.so
+LoadModule auth_pgsql_module   lib/httpd/mod_auth_pgsql.so
 AddType application/x-httpd-php .php
example for .htaccess:
AuthName "My PostgreSQL Authenticator"
AuthType basic

Auth_PG_Host localhost
Auth_PG_port 5432
Auth_PG_user postgres
Auth_PG_database www
Auth_PG_pwd_table valid_users
Auth_PG_uid_field user
Auth_PG_pwd_field password

<LIMIT GET POST>
        require valid-user
</LIMIT>
create table
上記例では Auth_PG_uid_field user となっているが、user という名前は使えない 気がする。そこでこれは userid という名前に変更する。 これに対応する表としては、次のようなものを用意した。
www=# create table valid_user (
      userid    varchar(40)  primary key,
        password  varchar(32),
        lock      integer      default 1
      );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "valid_user_pkey" for table "valid_user"
CREATE TABLE
www=# 
以下は以前に使っていたものの例:
AuthName "myauth"
AuthType Basic
AuthPGHost myhost
AuthPGDatabase mydb
AuthPGUserTable member
AuthPGPasswordField passwd
AuthPGUserNameField id
AuthPGEncrypted off

require valid-user
この場合、myhost が /usr/pkg/share/postgresql/pg_hba.conf に記載されている必要がある。 2004/04/02 に make install した時の 記録
GRANT
ttyp2:makoto@u  19:03:26/040402(...share/postgresql)> ERROR:  member: permission denied
と言われる時には、次のように grant する
fic=# grant select on member to www
この画面は Jeedosaquin によって表示しています。
Last Update: Sat, 04 May 2019 00:45:20 GMT 1.66 2008/03/08