PhpPgAdmin: Difference between revisions

From Alpine Linux
(replace /etc/init.d with rc-service)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
== What is phpPgAdmin? ==
[https://phppgadmin.sourceforge.net/doku.php phpPgAdmin] is a web-based administration tool for PostgreSQL.


phpPgAdmin is a web-based administration tool for PostgreSQL. It is perfect for PostgreSQL DBAs, newbies and hosting services.
== Install lighttpd, PHP, and postgresql ==
{{:Setting Up Lighttpd With FastCGI}}


== Set up phpPgAdmin on Alpine Linux ==
Install extra packages
 
{{Cmd|apk add postgresql postgresql-client php-pgsql}}
This document will be a very quick c/p guide to setup phpPgAdmin on Alpine linux. What we will setup is the following:
 
* Lighttpd with PHP
* postgresql
* phpPgAdmin
 
== Install lighttpd, PHP and postgresql ==
 
apk add lighttpd postgresql postgresql-client php-pgsql
 
== Configuring Lighttpd ==
 
'''Edit lighttpd.conf'''
 
nano +46 /etc/lighttpd/lighttpd.conf
 
Uncomment line:
 
uncoment    include "mod_fastcgi.conf", save and exit
 
'''Note:''' If you are using the Alpine ACF, change the lighttpd port:
 
nano +81 /etc/lighttpd/lighttpd.conf
 
uncomment and change the line to: server.port          = 8080
 
'''Starting http service and adding to boot'''
 
/etc/init.d/lighttpd start && rc-update add lighttpd default


== Configuring postgresql ==
== Configuring postgresql ==


/etc/init.d/postgresql setup
{{Cmd|rc-service postgresql setup}}


'''Starting http service and adding to boot'''
Starting http service and adding to boot.


/etc/init.d/postgresql start && rc-update add postgresql default
{{Cmd|rc-service postgresql start && rc-update add postgresql default}}


== Installing phpPgAdmin ==
== Installing phpPgAdmin ==


'''Install phpPgAdmin'''
Create a directory named {{Path|webapps}}
 
Make webapps folder


mkdir /usr/share/webapps/ -p
{{Cmd|mkdir -p /usr/share/webapps/}}


Download  
Download the latest release of phpPgAdmin.


cd /usr/share/webapps/
{{Cmd|cd /usr/share/webapps/
wget http://downloads.sourceforge.net/phppgadmin/phpPgAdmin-4.2.3.tar.gz
wget https://downloads.sourceforge.net/phppgadmin/phpPgAdmin-5.0.4.tar.gz}}


Unpack and delete tar file
Unpack and delete the tar file


tar zxvf phpPgAdmin-4.2.3.tar.gz
{{Cmd|tar zxvf phpPgAdmin-5.0.2.tar.gz
rm phpPgAdmin-4.2.3.tar.gz
rm phpPgAdmin-5.0.4.tar.gz}}


Change Folder Name
Change the folder name


mv phpPgAdmin-4.2.3 phppgadmin
{{Cmd|mv phpPgAdmin-5.0.4 phppgadmin}}


Change Config File Name
Copy the sample config file name


cp /usr/share/webapps/phppgadmin/conf/config.inc.php-dist /usr/share/webapps/phppgadmin/conf/config.inc.php
{{Cmd|cp /usr/share/webapps/phppgadmin/conf/config.inc.php-dist /usr/share/webapps/phppgadmin/conf/config.inc.php}}


Change Folder Persmissions
Change the folder permissions


chmod -R 777 /usr/share/webapps/
{{Cmd|chmod -R 777 /usr/share/webapps/}}


Make Symlink to the phpPgAdmin folder
Create a symlink to the {{Path|phpPgAdmin}} folder


ln -s /usr/share/webapps/phppgadmin/ /var/www/localhost/htdocs/phppgadmin
{{Cmd|ln -s /usr/share/webapps/phppgadmin/ /var/www/localhost/htdocs/phppgadmin}}


== Log on your phpPgAdmin ==
== Log on your phpPgAdmin ==


Browse to: http://WEBSERVER_IP_ADDRESS/phppgadmin and logon to phpPgAdmin using postgresql user and password.
Browse to: <nowiki>http://WEBSERVER_IP_ADDRESS/phppgadmin</nowiki> and logon to phpPgAdmin using postgresql user and password.
And enjoy this nice and useful tool.
 
'''Note:''' If you are using the Alpine ACF, or if you change the port in the lighttpd.conf file, the go to the port you set.
e.g: if you set the port to 8080, then browse to: http://WEBSERVER_IP_ADDRESS:8080/phppgadmin
 
== License ==


'''phpPgAdmin License'''
{{Note|If you are using the Alpine ACF, or if you change the port in the lighttpd.conf file, the go to the port you set.
e.g: if you set the port to 8080, then browse to: <nowiki>http://WEBSERVER_IP_ADDRESS:8080/phppgadmin</nowiki> }}


phpPgAdmin is released under GNU General Public License.The GNU Public License
[[Category:PHP]]
[[Category:SQL]]

Latest revision as of 09:43, 17 November 2023

phpPgAdmin is a web-based administration tool for PostgreSQL.

Install lighttpd, PHP, and postgresql

Basic Installation

For installing the additional packages first activate community packages and update the package index

Install the required packages:

# apk add lighttpd php82 fcgi php82-cgi

Configure Lighttpd

Edit lighttpd.conf (/etc/lighttpd/lighttpd.conf) and uncomment the line:

Contents of /etc/lighttpd/lighttpd.conf

... include "mod_fastcgi.conf" ...

Edit mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf), find and change /usr/bin/php-cgi to /usr/bin/php-cgi82.

Contents of /etc/lighttpd/mod_fastcgi.conf

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

Start lighttpd service and add it to default runlevel

# rc-service lighttpd start # rc-update add lighttpd default

Install extra packages

apk add postgresql postgresql-client php-pgsql

Configuring postgresql

rc-service postgresql setup

Starting http service and adding to boot.

rc-service postgresql start && rc-update add postgresql default

Installing phpPgAdmin

Create a directory named webapps

mkdir -p /usr/share/webapps/

Download the latest release of phpPgAdmin.

cd /usr/share/webapps/ wget https://downloads.sourceforge.net/phppgadmin/phpPgAdmin-5.0.4.tar.gz

Unpack and delete the tar file

tar zxvf phpPgAdmin-5.0.2.tar.gz rm phpPgAdmin-5.0.4.tar.gz

Change the folder name

mv phpPgAdmin-5.0.4 phppgadmin

Copy the sample config file name

cp /usr/share/webapps/phppgadmin/conf/config.inc.php-dist /usr/share/webapps/phppgadmin/conf/config.inc.php

Change the folder permissions

chmod -R 777 /usr/share/webapps/

Create a symlink to the phpPgAdmin folder

ln -s /usr/share/webapps/phppgadmin/ /var/www/localhost/htdocs/phppgadmin

Log on your phpPgAdmin

Browse to: http://WEBSERVER_IP_ADDRESS/phppgadmin and logon to phpPgAdmin using postgresql user and password.

Note: If you are using the Alpine ACF, or if you change the port in the lighttpd.conf file, the go to the port you set. e.g: if you set the port to 8080, then browse to: http://WEBSERVER_IP_ADDRESS:8080/phppgadmin