phpPgAdmin

提供: ArchWiki
2015年2月17日 (火) 23:24時点におけるKusakata (トーク | 投稿記録)による版 (ページの作成:「Category:ウェブサーバー en:phpPgAdmin {{lowercase title}} {{Related articles start}} {{Related|PostgreSQL}} {{Related articles end}} [http://phppgadmin.sou...」)
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
ナビゲーションに移動 検索に移動

関連記事

phpPgAdmin は Apache/PHP フロントエンドを使用して PostgreSQL データベースを管理するウェブベースのツールです。Apache/PHP のセットアップを必要とするので、LAMP を見てセットアップしてください。

インストール

公式リポジトリから phppgadminphp-pgsqlphp-fpm パッケージをインストールしてください。

設定

PHP

/etc/php/php.ini を編集して以下の行をアンコメントして PHP の pgsql 拡張を有効にする必要があります:

extension=pgsql.so

PHP が /etc/webapps にアクセスできるか確認してください。必要ならば /etc/php/php.iniopen_basedir に追加します:

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps

ウェブサーバー

Apache

Apache 設定ファイルを作成:

/etc/httpd/conf/extra/phppgadmin.conf
Alias /phppgadmin "/usr/share/webapps/phppgadmin"
<Directory "/usr/share/webapps/phppgadmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted
</Directory>

そして /etc/httpd/conf/httpd.conf でインクルード:

# phpPgAdmin configuration
Include conf/extra/phppgadmin.conf

By default, everyone can see the phpPgAdmin page, to change this, edit /etc/httpd/conf/extra/phppgadmin.conf to your liking. For example, if you only want to be able to access it from the same machine, replace Require all granted by Require local.

Lighttpd の設定

The php setup for lighttpd is exactly the same as for apache. Make an alias for phppgadmin in your lighttpd config.

 alias.url = ( "/phppgadmin" => "/usr/share/webapps/phppgadmin/")

Then enable mod_alias, mod_fastcgi and mod_cgi in your config ( server.modules section )

Make sure lighttpd is setup to serve php files, Lighttpd#FastCGI

Restart lighttpd and browse to http://localhost/phppgadmin/index.php

NGINX の設定

Create a symbolic link to the /usr/share/webapps/phppgadmin directory from whichever directory your vhost is serving files from, e.g. /srv/http/<domain>/public_html/

 sudo ln -s /usr/share/webapps/phppgadmin /srv/http/<domain>/public_html/phppgadmin

You can also setup a sub domain with a server block like so (if using php-fpm):

Also, you need to use at less php-fpm (you need it), you have to make it running first (if you not do it, you will have a "502 bad gateway" error instead of the phpPgadmin first page).

For make it running after install the package, make a "systemctl start php-fpm" (and enable it if you want to use it all the time and/or after reboot, by "systemctl enable php-fpm)

 server {
         server_name     phppgadmin.<domain.tld>;
         access_log      /srv/http/<domain>/logs/phppgadmin.access.log;
         error_log       /srv/http/<domain.tld>/logs/phppgadmin.error.log;
 
         location / {
                 root    /srv/http/<domain.tld>/public_html/phppgadmin;
                 index   index.html index.htm index.php;
         }
 
         location ~ \.php$ {
                 root            /srv/http/<domain.tld>/public_html/phppgadmin;
                 fastcgi_pass    unix:/var/run/php-fpm/php-fpm.sock;
                 fastcgi_index   index.php;
                 fastcgi_param   SCRIPT_FILENAME  /srv/http/<domain.tld>/public_html/phppgadmin/$fastcgi_script_name;
                 include         fastcgi_params;
         }
 }

but there is an other simple way to do it running (also, if you need some other web apps, it would be easy more after):

 server {
     listen 80;
     server_name localhost default_server;
     root /srv/http/www/public_html;
     index index.html index.html index.php;
     location ~ \.php$ {
         try_files $uri =404;
         include fastcgi_params;
         fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } }


with this config, your phppgadmin will be accessible at http://localhost/phppgadmin directly and you will be able also to add some other web apps easy in the same way

(just have to paste/link them under public_html directory and find it at localhost/your_webapps)

this config make working all php file inside your localhost directly

(also it is a good idea to allow a user http http in the top of this nginx file and make directory srv/http/ under http owner/group)

the "server" serve only if you want to create some other server name designed only for this...

also, make a root inside the location of php is not a simple way to do and make the config file in trouble...

phpPgAdmin の設定

phpPgAdmin の設定ファイルは /etc/webapps/phppgadmin/config.inc.php にあります。ローカルで PostgreSQL サーバーを動かしている場合は、何も設定しなくても動作するはずです。

PostgreSQL サーバーが localhost 上にない場合は、以下の行を編集してください:

$conf['servers'][0]['host'] = ;

phpPgAdmin にアクセス

Your phpPgAdmin installation is now complete. Before start using it you need to restart your apache server by following command:

# systemctl restart httpd.service

You can access your phpPgAdmin installation by going to http://localhost/phppgadmin/

トラブルシューティング

セキュリティ上の理由でログインが拒否される

If extra login security is true, then logins via phpPgAdmin with no password or certain usernames (pgsql, postgres, root, administrator) will be denied. Only set this to false once you have read the FAQ and understand how to change PostgreSQL's pg_hba.conf to enable passworded local connections.

Edit /etc/webapps/phppgadmin/config.inc.php and change the following line

 $conf['extra_login_security'] = true;

to

 $conf['extra_login_security'] = false;