本文档介绍如何使用tar包在Linux(我用的centos5.5)下编译安装pgsql 和配置php-pgsql扩展,使php能够连接pgsql数据库。
一.安装postgresql数据库
1.首先到postgresql 官网http://www.doczj.com/doc/b0997882ad51f01dc381f15e.html/下载安装包,这里用的是postgresql-8.4.0.tar.gz这个版本。
2.开始安装
为pgsql创建系统用户组和用户
[root@localhost src] groupadd postgresql //新增postgreql用户组[root@localhost src] useradd –g postgresql postgres //新增postgres用户属于postgresql用户组
[root@localhost src] passwd postgres //修改postgres用户密码,回车后输入密码
解压安装包并编译安装
[root@localhost src] tar –xzvf postgresql-8.4.0.tar.gz
[root@localhost src] cd postgresql-8.4.0
[root@localhost postgresql-8.4.0] ./configure --prefix =/usr/local/pgsql [root@localhost postgresql-8.4.0] gmake
[root@localhost postgresql-8.4.0] gmake install
配置环境变量
[root@localhost postgresql-8.4.0] vi /etc/profile //配置环境变量,打开profile文件,加入以下配置
LD_LIBRARY_PATH=/usr/local/pgsql/lib