1.安装pg
安装PostgreSQL数据库
修改pg_hba。conf配置文件,使得数据库可以通过外部访问。
具体可以配置为:
# TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all md5 # IPv4 local connections: host all all 127.0.0.1/32 md5 host all all 0.0.0.0/0 md5 # IPv6 local connections: host all all ::1/128 trust host all all 0.0.0.0/0 trust
2.安装apache
下载安装文件,如:httpd-2.4.4.tar.gz
默认会安装到/etc/httd/下面
安装完毕后,可以先启动服务service httpd start,然后到浏览器输入地址:http://ip:80,正常会出现apache test page。
3.安装phPgAdmin
下载:phpPgAdmin-5.1.tar.gz
到/var/www/解压即可。
4.配置php 文件目录以及监听端口
vi /etc/httpd/conf/httpd.conf
首先找到端口(默认为80):
# # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, in addition to the default. See also the <VirtualHost> # directive. # # Change this to Listen on specific IP addresses as shown below to # prevent Apache from glomming onto all bound IP addresses (0.0.0.0) # #Listen 12.34.56.78:80 Listen 80
然后是php的文件目录
# # "/var/www/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # <Directory "/var/www/cgi-bin"> AllowOverride None Options None Order allow,deny Allow from all </Directory> #liuyy #phpPgAdmin Alias /phppgadmin "/var/www/phpPgAdmin" <Directory "/var/www/phpPgAdmin"> Options Indexes Multiviews AllowOverride None Order allow,deny Allow from all </Directory>
注意:/phppgadmin才是在浏览器中要输入的地址,而不是文件名(phpPgAdmin)本身。
5.以上配置完毕后,在terminal中重启apache服务:service httpd restart
到浏览器中输入地址:http://ip:port/ phppgadmin
正常会出现phppgadmin的管理界面。