Administration Tools


Some graphical interfacing with PostgreSQL is already available. In this section, you learn to use phpPgAdmin .

phpPgAdmin

One of the most widespread administration tools in the world of PostgreSQL is phpPgAdmin. The tool has been implemented in PHP and therefore can easily be modified. phpPgAdmin is easy to use and provides a lot of useful functions in a reliable way. Because the application is written in PHP, the tool has to be accessed via a Web browser. We recommend running it in a protected directory of your Web server, to make sure that no unauthorized people can access phpPgAdmin on your system.

 phpPgAdmin is available under the terms of the GNU General Public License and can be downloaded from the following URL: http://freshmeat.net/projects/phppgadmin/ 
Installing phpPgAdmin

After downloading the software, you install it on your system. First, unpack the tar archive that you downloaded with the following shell command:

 [hs@athlon /tmp]$  tar xvfz phpPgAdmin_2-3.tar.gz  

You have to unpack the code in a directory, which can be accessed by your Web server, in order to run phpPgAdmin. If the source code has been installed properly, you configure the software by editing the file config.inc.php, which can be found in the directory containing the sources of phpPgAdmin.

We go to line 56 (in our version of phpPgAdmin) and create a new user who can access all databases. Here is an example:

 $cfgServers[1]['local']         = true; $cfgServers[1]['host']          = 'localhost'; $cfgServers[1]['port']          = '5432'; $cfgServers[1]['adv_auth']      = true; $cfgServers[1]['stduser']       = 'hs'; $cfgServers[1]['stdpass']       = 'apassword'; $cfgServers[1]['user']          = 'hs'; $cfgServers[1]['password']      = 'apassword'; $cfgServers[1]['only_db']       = '';   // if set to a db-name, only this db is accessible 

User hs is allowed to log into phpPgAdmin in order to administer and modify the database now.

You can see in the config file that a lot of other things can be configured as well. Every parameter that can be modified in that file is documented, and it should be an easy task to set up a configuration for your PostgreSQL server.

Working with phpPgAdmin

When you have successfully configured the server, you log into the administration tool by using the Web interface (index.php). You have to use the user and the password that you have just defined. If the authentification succeeds, weyou can start working with PostgreSQL now. Figure 10.1 shows the user interface.

Figure 10.1. The phpPgAdmin user interface.

graphics/10fig01.gif

On the left side of the screen is a list of all databases on the system, including the list of tables that each database contains. It can be accessed by clicking the item that you want to see more information about, in the right frame of the site.

A lot of functions are provided. You can create or drop tables, browse the data, or perform tasks such as defining an index. Nearly all things can be done with the help of a simple mouse click, because the tool is intuitional and easy to use.



PostgreSQL Developer's Handbook2001
PostgreSQL Developer's Handbook2001
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 125

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net