A guide to getting started with PostgreSQL management tool phpPgAdmin

  • 2020-05-06 11:51:42
  • OfStack

1. Install phpPgAdmin
unpacks

from the downloaded zip

For tar.gz, execute the following command:

gunzip phpPgAdmin-*.tar.gz
tar -xvf phpPgAdmin-*.tar

For tar.bz2, execute the following command:

bunzip2 phpPgAdmin-*.tar.bz2
tar -xvf phpPgAdmin-*.tar

For.zip, execute the following command:

unzip phpPgAdmin-*.zip

ii, phpPgAdmin

configuration

Edit phpPgAdmin conf/config. inc.

php file

If you mess up the configuration files, you can use the config.inc.php-dist file to recover.

3. Create reports database

If you want to enable reports(a useful feature), check out the reports-pgsql.sql script in the 'sql' subdirectory.
It contains instructions on how to create the reports database.

4. Dump function related to

if you are running PHP in secure mode, in order for the database dump to work properly,
You must include the 'safe_mode_allowed_env_vars' directive in php.ini with the PGPASSWORD and PGUSER environment variables,
You also need to include the directory where the pg_dump binary is located in the 'safe_mode_exec_dir' directive.
For example:

 safe_mode_allowed_env_vars = PHP_,PG
 safe_mode_exec_dir = /usr/bin

Generally speaking, you don't want all the programs in /usr/bin to be executed,
So you may need to copy pg_dump and pg_dumpall to separate directories.

Also, if you want phpPgAdmin to support dumps,
You also need to make sure that pg_dump and pg_dumpall can be executed by processes running PHP.

Finally, if you run phpPgAdmin in safe mode,
Long-running imports, exports, and transactions may exit due to a timeout.

5, PostgreSQL statistics collector

If PostgreSQL's statistics program is enabled (statistics collector),
phpPgAdmin displays performance and usage statistics for tables and indexes.
To enable this, uncomment the following line in the postgresql.conf file:


 stats_start_collector = true
 stats_command_string = true
 stats_block_level = true
 stats_row_level = true

6. cookies
in order to use phpPgAdmin properly in the browser, you must enable cookies in the browser.

important - safety related

PostgreSQL does not require a password to log in by default,
We strongly recommend that you configure pg_hba.conf to use the md5 password for local links,
And set a password for the default superuser.

Due to the large number of installed phpPgAdmin and no passwords for local connections,
We provide a configuration option called 'extra_login_security', which defaults to TRUE.
This means you cannot login with 'root','administrator','pgsql','postgres' user or an empty password.

Set 'extra_login_security' to fasle,
only after you have made sufficient security Settings for the database This allows you to log in as an administrator using the administrator password.

8. Tips:


when display_errors = On in php.ini and error_reporting contains errors at levels other than ERROR phpPgAdmin is often not used smoothly, probably because the code does not strictly adhere to the coding style PHP developers expect.
So if something goes wrong, try display_errors = Off and you might be able to solve some annoying problems in use.


Related articles: