phpPgAdmin - Documentation

# phpPgAdmin 2.4.x- Documentation

http://sourceforge.net/projects/phppgadmin
Dan Wilson

Version history: ChangeLog
Installation instructions: INSTALL
General notes: README

## Configuration

All configurable data is placed in config.inc.php.

$cfgServers array
phpPgAdmin supports the adminstration of multiple PostgreSQL servers. A $cfgServers-array contains the login information for the different server. $cfgServers[0]['host'] contains the hostname of the first server, $cfgServers[0]['host'] the hostname of the second server, etc. If you have only one server to administer, simply leave free the hostname of the other $cfgServer-entries.

$cfgServers[n]['local'] bool
Determines whether the host is on the local machine or not.

$cfgServers[n]['port'] string
The port-number of your n-th PostgreSQL server. Default is 5432.

$cfgServers[n]['host'] string
The hostname of your n-th PostgreSQL server. E.g. localhost.

$cfgServers[n]['adv_auth'] boolean
Whether basic or advanced authentification should be used for this server. Basic authentification ($adv_auth = false) is the plain old way: username and password are stored in config.inc.php. Advanced authentication $adv_auth = true) allows you to log in as any valid PostgreSQL user via HTTP-Auth. All you have to provide in config.inc.php is a standard user which can connect to PostgreSQL and read the PostgreSQL user table.
Using advanced authentification is recommended:

- when you want to give users access to their own database and don't want them to play around with others.

$cfgServers[n]['user'] string
$cfgServers[n]['password'] string
The user/password-pair which phpPgAdmin will use to connect to this PostgreSQL server. Not needed when using advanced authentication.

$cfgServers[n]['only_db'] string
If set to a database name, only this database will be shown to the user.

$cfgDefaultDB string
The default database is used to connect to the database to check the adv_auth and perform other "general" tasks. This can actually be any database you currently have on your system. It just needs _a_ database to connect and check the system tables.

$cfgSuperUser string
Set the $cfgSuperUser to be the user you used to install postgres. This is just used to filter out the system functions/tables when listing

$cfgSysTables bool
If you want to be able to view the contents and structure of the System Catalog/Tables set this to true. If you are new to Postgres or are not familiar with the system tables, you should leave this as false.

$cfgUserAdmin bool
If you want the web interface to administer postgres user, set this as true.

$cfgDebug bool
Set this to true during development of phpPgAdmin

$cfgQuotes bool
If you want to quote all relations (enabling capitalization), set this to true.

$cfgMaxPages int
This value controls the number of links to different "pages" when browsing a table. It will display $cfgMaxPages number of links before and after the current page.

$cfgManualBase string
If set to an URL which points to the PostgreSQL documentation, appropriate help links are generated.

$cfgPersistentConnections boolean
Whether persistent connections should be used or not (pg_connect or pg_pconnect). Persistent connection are not currently recomended as the author has expirienced unexpected results.

$cfgConfirm boolean
Whether a warning ("Are your really sure..") should be displayed when you're about to loose data.

$cfgMaxRows integer
Number of rows displayed when browsing a resultset. If the resultset contains more rows, Previous/Next links will be shown.

$cfgMaxInputsize integer
Size of the edit-field when adding a new record to a table.

$cfgBorder integer
The size of a table's border.

$cfgThBgcolor string [HTML color]
The color (HTML) used for table headers.

$cfgBgcolorOne string [HTML color]
The color (HTML) #1 for table rows.

$cfgBgcolorTwo string [HTML color]
The color (HTML) #2 for table rows.

$cfgOrder string ["DESC"|"ASC"]
Defines whether fields are displayed in ascending ("ASC") order or in descending ("DESC") order when you click on the field-name.

$cfgShowSQL boolean
Defines whether sql-queries generated by phpPgAdmin should be displayed or not.

## FAQ - Frequently Asked Questions

I can't insert new rows into a table - PostgreSQL brings up a SQL-error.
Most of the time it just that - a SQL error. Probably you're specifying a wrong field-type. Common errors include:

- VARCHAR without a size argument
- TEXT or BLOB with a size argument

At least I made this error often when I started using PostgreSQL :-)
Have a look at the PostgreSQL manual (syntax chapter) when in doubt.

phpPgAdmin can't connect to PostgreSQL. What's wrong?
Either there is an error with your PHP setup or your username/password is wrong. Try to make a small script which uses pg_connect and see if it works. If it doesn't, it may be you haven't even compiled PostgreSQL support into PHP.

I cannot edit the content of a table, even if the README says this is a feature of phpPgAdmin.
phpPgAdmin requires a table to have a unique or primary key to allow edit/delete buttons when using browse or select functionality.

phpPgAdmin always gives "Access denied" when using advanced authentification.
This could happen for several reasons:

- Try to turn off $adv_auth and use this username and password to connect to PostgreSQL.
- The username/password you specify in the login-dialog is wrong. Try the same as above and see if it works.
- You have already setup a security mechanism for the phpPgAdmin-directory, eg. a .htaccess file. This would interfere with phpPgAdmin's authentification, so remove it.

I would like to help out with the development of phpPgAdmin. How should I proceed?
The following method is preferred for new developers:

- fetch the current CVS tree over anonymous CVS:
  cvs -d:pserver:anonymous@cvs.phppgadmin.sourceforge.net:/cvsroot/phppgadmin login
  [Password: Just press the Enter Key!]
  cvs -z3 -d:pserver:anonymous@cvs.phppgadmin.sourceforge.net:/cvsroot/phppgadmin co phpPgAdmin
  [This will create a new sub-directory named phpPgAdmin]
- add your stuff
- send me the modified files (tar'ed and gzip'ed) Write access to the CVS tree is granted only to experienced developers who have already contributed something useful to phpPgAdmin.
  Also, have a look at the file DEVELOPERS.

What's the preferred way of making phpPgAdmin secure against evil access?
This depends on your system. If you're running a server which cannot be accessed by other people, it's sufficient to use the directory protection bundled with your webserver (with Apache you can use .htaccess files, for example). If other people have telnet access to your server, it's not a good idea to store the PostgreSQL password in clear text in your config.inc.php file. You should use phpPgAdmin's advanced authentification feature in this case.