By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 2,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

Best PostgreSQL Install Practices

P: n/a
The PHP web app that I'm building uses PostgreSQL. Of course it won't
work right off the bat, so my web app is going to have to detect that
it has never been configured with a database and have to instruct the
sysop on what to do. What are developers in the PHP industry doing with
their installers to ensure everything with PostgreSQL is going to work
out right?

In particular I'm going to want the web app to have a local database
(by default), although a remote one is an option. The web app will
require a username and password to reach the database. What pg_hba.conf
configuration would you recommend most highly for new installations?

Jan 6 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Alfred wrote:
The PHP web app that I'm building uses PostgreSQL. Of course it won't
work right off the bat, so my web app is going to have to detect that
it has never been configured with a database and have to instruct the
sysop on what to do. What are developers in the PHP industry doing with
their installers to ensure everything with PostgreSQL is going to work
out right?
Just describe clearly what users on the database are made and what their
rights should be.
Maybe add some tutorial with commands for GRANT or something.
Then let the guy that installs the database read that document.

Also add a SQL-script that creates the tables/relations/etc.
Do not make a binary dump, but the text-SQL variant, so people can actually
read what tables are created.

You do not want to make a seperate installer for Postgresql, are you?

>
In particular I'm going to want the web app to have a local database
(by default), although a remote one is an option. The web app will
require a username and password to reach the database. What pg_hba.conf
configuration would you recommend most highly for new installations?
Well, the pg_hba.conf is a file that should be maintained by the sysop.
So just mention WHICH users should be added with what rights.
Maybe suggest the lines to add to pg_hba.conf.

For security, do not allow others on the same machine (trust-setting) to
connect to your database. The 'fallthrough' approach is used in
postgresql's pg_hba.conf, so you must explicity say that other cannot
connect if you have a few users in the environment.
To make this sure, add a 'reject' as last line for your listed allowed
connections to your database.

Good luck, and wise choice (Postgres). :-)

Regards,
Erwin Moller
Jan 8 '07 #2

P: n/a
Erwin Moller, thanks for your opinion. That's pretty much how I was
going to do it:

1. Provide DB's CREATEDB and GRANT statements for the user account used
by the web app.

2. Suggest the pg_hba.conf changes for the sysop, and try to prohibit
anything connecting to my web app except the ID specified, and only
from the IP address of where the web app is hosted.

3. Generate a SQL script to load the default database tables.
I was going to have the web app detect it's not installed by default
and start to display a wizard-like set of screens that describe the
process of setting the application up in really user-friendly terms.

Jan 8 '07 #3

P: n/a
Alfred wrote:
Erwin Moller, thanks for your opinion. That's pretty much how I was
going to do it:

1. Provide DB's CREATEDB and GRANT statements for the user account used
by the web app.

2. Suggest the pg_hba.conf changes for the sysop, and try to prohibit
anything connecting to my web app except the ID specified, and only
from the IP address of where the web app is hosted.

3. Generate a SQL script to load the default database tables.
I was going to have the web app detect it's not installed by default
and start to display a wizard-like set of screens that describe the
process of setting the application up in really user-friendly terms.
Sounds good. :-)

Good luck!

Regards,
Erwin Moller
Jan 9 '07 #4

P: n/a
BTW, Erwin Moller (and others), a friend sent me these links on how to
optimize postgresql.conf for more speed. By default this is usually
tuned way back on most Linux distros. These hyperlinks should be good
information for PHP programmers who use PostgreSQL.

http://www.varlena.com/varlena/Gener...bits/perf.html

http://www.powerpostgresql.com/Downl...d_conf_80.html

Jan 10 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.