「PhpPgAdmin」の版間の差分
(ページの作成:「Category:ウェブサーバー en:phpPgAdmin {{lowercase title}} {{Related articles start}} {{Related|PostgreSQL}} {{Related articles end}} [http://phppgadmin.sou...」) |
(同期) |
||
| 1行目: | 1行目: | ||
| + | {{lowercase title}} |
||
[[Category:ウェブサーバー]] |
[[Category:ウェブサーバー]] |
||
[[en:phpPgAdmin]] |
[[en:phpPgAdmin]] |
||
| − | {{lowercase title}} |
||
{{Related articles start}} |
{{Related articles start}} |
||
{{Related|PostgreSQL}} |
{{Related|PostgreSQL}} |
||
{{Related articles end}} |
{{Related articles end}} |
||
| − | [http://phppgadmin.sourceforge.net/ phpPgAdmin] は Apache/PHP フロントエンドを使用して PostgreSQL データベースを管理するウェブベースのツールです |
+ | [http://phppgadmin.sourceforge.net/ phpPgAdmin] は Apache/PHP フロントエンドを使用して PostgreSQL データベースを管理するウェブベースのツールです。 |
== インストール == |
== インストール == |
||
| + | PhpPgAdmin は Apache など PHP が使えるウェブサーバーを必要とします。[[Apache HTTP Server]] と [[Apache HTTP Server#PHP]] を見てセットアップしてください。 |
||
| − | [[公式リポジトリ]]から {{Pkg|phppgadmin}} と {{Pkg|php-pgsql}} と {{Pkg|php-fpm}} パッケージを[[インストール]]してください。 |
||
| + | |||
| + | {{Pkg|phppgadmin}} パッケージを[[インストール]]してください。 |
||
== 設定 == |
== 設定 == |
||
| 37行目: | 39行目: | ||
Include conf/extra/phppgadmin.conf |
Include conf/extra/phppgadmin.conf |
||
| − | + | デフォルトでは誰でも phpPgAdmin のページを閲覧できてしまいます。変更するには {{ic|/etc/httpd/conf/extra/phppgadmin.conf}} を編集してください。例えば、同じマシンからのアクセスだけを許可するには {{ic|Require all granted}} を {{ic|Require local}} に置き換えます。 |
|
| − | ====Lighttpd |
+ | ====Lighttpd==== |
| + | lighttpd の php の設定は apache と全く同じです。 |
||
| − | 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 ) |
||
| + | lighttpd の設定に phppgadmin のエイリアスを作成してください: |
||
| − | Make sure lighttpd is setup to serve php files, [[Lighttpd#FastCGI]] |
||
| + | alias.url = ( "/phppgadmin" => "/usr/share/webapps/phppgadmin/") |
||
| + | そして設定で mod_alias, mod_fastcgi, mod_cgi を有効にしてください (server.modules セクション)。 |
||
| + | lighttpd で php ファイルを使えるようにする方法は [[Lighttpd#FastCGI]] を参照。 |
||
| − | Restart lighttpd and browse to http://localhost/phppgadmin/index.php |
||
| + | lighttpd を再起動して http://localhost/phppgadmin/index.php を開いてください。 |
||
| − | ====NGINX の設定==== |
||
| + | ====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/ |
||
| + | バーチャルホストのディレクトリ (例: {{ic|/srv/http/<domain>/public_html/}}) から {{ic|/usr/share/webapps/phppgadmin}} ディレクトリにシンボリックリンクを作成してください: |
||
| − | sudo ln -s /usr/share/webapps/phppgadmin /srv/http/<domain>/public_html/phppgadmin |
||
| + | # 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): |
||
| + | |||
| + | 同じように server ブロックを使ってサブドメインを設定することもできます (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). |
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). |
||
| 62行目: | 65行目: | ||
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) |
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): |
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 |
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 |
||
| 112行目: | 114行目: | ||
PostgreSQL サーバーが localhost 上にない場合は、以下の行を編集してください: |
PostgreSQL サーバーが localhost 上にない場合は、以下の行を編集してください: |
||
| − | $conf['servers'][0]['host'] = ''; |
+ | <nowiki>$conf['servers'][0]['host'] = '';</nowiki> |
==phpPgAdmin にアクセス== |
==phpPgAdmin にアクセス== |
||
| + | phpPgAdmin のインストールが完了したら、使用する前に以下のコマンドで apache サーバーを再起動してください: |
||
| − | Your phpPgAdmin installation is now complete. Before start using it you need to restart your apache server by following command: |
||
# systemctl restart httpd.service |
# systemctl restart httpd.service |
||
| − | + | http://localhost/phppgadmin/ から phpPgAdmin にアクセスできます。 |
|
== トラブルシューティング == |
== トラブルシューティング == |
||
| 124行目: | 126行目: | ||
=== セキュリティ上の理由でログインが拒否される === |
=== セキュリティ上の理由でログインが拒否される === |
||
| − | + | extra login security が true の場合、phpPgAdmin でパスワードを指定しなかったり特定のユーザー名 (''pgsql'', ''postgres'', ''root'', ''administrator'') でのログインが拒否されます。{{ic|false}} に設定したい場合 FAQ を読んで PostgreSQL の {{ic|pg_hba.conf}} を変更してパスワードによるローカル接続を有効にしてください。 |
|
| − | + | {{ic|/etc/webapps/phppgadmin/config.inc.php}} を編集して以下の行を: |
|
| − | + | $conf['extra_login_security'] = true; |
|
| + | 以下のように変更: |
||
| − | to |
||
| − | + | $conf['extra_login_security'] = false; |
|
2017年6月22日 (木) 00:49時点における版
関連記事
phpPgAdmin は Apache/PHP フロントエンドを使用して PostgreSQL データベースを管理するウェブベースのツールです。
目次
インストール
PhpPgAdmin は Apache など PHP が使えるウェブサーバーを必要とします。Apache HTTP Server と Apache HTTP Server#PHP を見てセットアップしてください。
phppgadmin パッケージをインストールしてください。
設定
PHP
/etc/php/php.ini を編集して以下の行をアンコメントして PHP の pgsql 拡張を有効にする必要があります:
extension=pgsql.so
PHP が /etc/webapps にアクセスできるか確認してください。必要ならば /etc/php/php.ini の open_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
デフォルトでは誰でも phpPgAdmin のページを閲覧できてしまいます。変更するには /etc/httpd/conf/extra/phppgadmin.conf を編集してください。例えば、同じマシンからのアクセスだけを許可するには Require all granted を Require local に置き換えます。
Lighttpd
lighttpd の php の設定は apache と全く同じです。
lighttpd の設定に phppgadmin のエイリアスを作成してください:
alias.url = ( "/phppgadmin" => "/usr/share/webapps/phppgadmin/")
そして設定で mod_alias, mod_fastcgi, mod_cgi を有効にしてください (server.modules セクション)。
lighttpd で php ファイルを使えるようにする方法は Lighttpd#FastCGI を参照。
lighttpd を再起動して http://localhost/phppgadmin/index.php を開いてください。
nginx
バーチャルホストのディレクトリ (例: /srv/http/<domain>/public_html/) から /usr/share/webapps/phppgadmin ディレクトリにシンボリックリンクを作成してください:
# ln -s /usr/share/webapps/phppgadmin /srv/http/<domain>/public_html/phppgadmin
同じように server ブロックを使ってサブドメインを設定することもできます (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 にアクセス
phpPgAdmin のインストールが完了したら、使用する前に以下のコマンドで apache サーバーを再起動してください:
# systemctl restart httpd.service
http://localhost/phppgadmin/ から phpPgAdmin にアクセスできます。
トラブルシューティング
セキュリティ上の理由でログインが拒否される
extra login security が true の場合、phpPgAdmin でパスワードを指定しなかったり特定のユーザー名 (pgsql, postgres, root, administrator) でのログインが拒否されます。false に設定したい場合 FAQ を読んで PostgreSQL の pg_hba.conf を変更してパスワードによるローカル接続を有効にしてください。
/etc/webapps/phppgadmin/config.inc.php を編集して以下の行を:
$conf['extra_login_security'] = true;
以下のように変更:
$conf['extra_login_security'] = false;