PHP and PostgreSQL Database installation on OpenBSD 2.9

go to

cd /usr/ports/databases/postgresql

type

make

8.1MB downloads, this will take a while about 40 mins on a 28.8 modem

make install

then go

cd /usr/local/share/doc/postgresql/

less README.OpenBSD

Read this document for further instructions on the completion of the install

1. Create the PostgreSQL user and group:

useradd -c "PostgreSQL Admin User" -g =uid -m -d /var/postgresql \-s /bin/sh postgresql

2. su to the PostgreSQL account and initialize the database:

su - postgresql

mkdir /var/postgresql/data

initdb -D /var/postgresql/data

add the recommended lines to rc.local as root

then start the server with

su -l postgresql -c "/usr/local/bin/pg_ctl start \

-D /var/postgresql/data -l /var/postgresql/logfile \

-o '-D /var/postgresql/data'"

The PostgreSQL daemon can be shutdown with

su -l postgresql -c "/usr/local/bin/pg_ctl stop -m fast \

-D /var/postgresql/data"

rm -f /var/postgresql/data/postmaster.pid

Leave all other settings as default

su - postgresql

create uls

then

createuser

username

no

no

you may create additional users if you wish

you must have a www user in order for apache to have access to the databas

Now for the php part

go to

cd /usr/ports/www/php4

then type

env FLAVOR="postgresql" make

and then to install type

env FLAVOR="postgresql" make install

then to finish the install

/usr/local/sbin/php4-enable

Copy the sample file below into /var/www/conf/php.ini

/usr/local/share/doc/php.ini-dist

 

add this line to http.conf

AddType application/x-httpd-php .php

then restart apache with

apachectl graceful

Create the following directories

the database will be placed in

/var/www/htdocs/narromine/php/

also a library of files is added to

/var/www/library/

PHP4 needed to be recompiled to include support for graphics and pdf files use:

cd /usr/ports/www/php4/

env FLAVOR="gd pdflib postgresql" make

followed by

env FLAVOR="gd pdflib postgresql" make install