ubuntu8.04下安装apache2+php5+postgresql
发表于 : 2008-06-05 16:46
ubuntu8.04下安装apache2+php5+postgresql
1.安装
1.1 安装apache2
sudo apt-get install apache2
1.2 安装php5
sudo apt-get install php5
1.3 安装postgresql
sudo apt-get install postgresql-8.3.1
1.4 安装php5的postgresql支持库和GD库
sudo apt-get install php5-pgsql php5-gd
2.配置
2.1 配置apache2
参考文献:
http://wiki.ubuntu.org.cn/index.php?tit ... iant=zh-cn
http://kajaa.bbs.us/ApacheManual/
2.2 配置php5
参考文献:
http://wiki.ubuntu.org.cn/index.php?tit ... iant=zh-cn
http://www.phpx.com/php/zh/
2.3 配置postgresql
参考文献:
http://wiki.ubuntu.org.cn/index.php?tit ... iant=zh-cn
http://www.pgsqldb.org/pgsqldoc-8.1c/index.html
http://www.pgsqldb.org/mwiki/index.php/ ... 6%E9%A1%B5
3.测试
3.1 测试1
---------------------------------------
#文件名:test1.php
#目的:查看php5安装情况
<?php phpinfo() ?>
---------------------------------------
打开页面记得查看三处内容:
3.1.1 "Loaded Configuration File" 正确的话后面应该是php.ini文件的路径
3.1.2 "PDO drivers" 正确的话后面应该是pgsql
3.1.3 有没有单独的pgsql表格,一般有版本信息、SSL支持等,有的话说明正常加载pgsql
3.2 测试2
---------------------------------------
#文件名:test2.php
#目的:测试数据库连接情况
#请记得更换下面的主机IP、端口、数据库名称、用户名、用户口令,当然测试前得先createdb和createuser好数据库和用户.
<?php
$conn = pg_connect("host=主机IP port=端口 dbname=数据库名称 user=用户名 password=用户口令");
if (!$conn)
{
die("An error occured.");
}
else
{
echo "ok";
}
?>
----------------------------------------
打开页面当然得显示“ok”才算OK喽!
4.postgresql相关学习资料
4.1PostgreSQL必备参考手册.pdf
http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... %8f%91.pdf
4.2PostgreSQL对象关系数据库开发.pdf
http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... %86%8c.pdf
1.安装
1.1 安装apache2
sudo apt-get install apache2
1.2 安装php5
sudo apt-get install php5
1.3 安装postgresql
sudo apt-get install postgresql-8.3.1
1.4 安装php5的postgresql支持库和GD库
sudo apt-get install php5-pgsql php5-gd
2.配置
2.1 配置apache2
参考文献:
http://wiki.ubuntu.org.cn/index.php?tit ... iant=zh-cn
http://kajaa.bbs.us/ApacheManual/
2.2 配置php5
参考文献:
http://wiki.ubuntu.org.cn/index.php?tit ... iant=zh-cn
http://www.phpx.com/php/zh/
2.3 配置postgresql
参考文献:
http://wiki.ubuntu.org.cn/index.php?tit ... iant=zh-cn
http://www.pgsqldb.org/pgsqldoc-8.1c/index.html
http://www.pgsqldb.org/mwiki/index.php/ ... 6%E9%A1%B5
3.测试
3.1 测试1
---------------------------------------
#文件名:test1.php
#目的:查看php5安装情况
<?php phpinfo() ?>
---------------------------------------
打开页面记得查看三处内容:
3.1.1 "Loaded Configuration File" 正确的话后面应该是php.ini文件的路径
3.1.2 "PDO drivers" 正确的话后面应该是pgsql
3.1.3 有没有单独的pgsql表格,一般有版本信息、SSL支持等,有的话说明正常加载pgsql
3.2 测试2
---------------------------------------
#文件名:test2.php
#目的:测试数据库连接情况
#请记得更换下面的主机IP、端口、数据库名称、用户名、用户口令,当然测试前得先createdb和createuser好数据库和用户.
<?php
$conn = pg_connect("host=主机IP port=端口 dbname=数据库名称 user=用户名 password=用户口令");
if (!$conn)
{
die("An error occured.");
}
else
{
echo "ok";
}
?>
----------------------------------------
打开页面当然得显示“ok”才算OK喽!
4.postgresql相关学习资料
4.1PostgreSQL必备参考手册.pdf
http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... %8f%91.pdf
4.2PostgreSQL对象关系数据库开发.pdf
http://ubuntu:ubuntuftp@ftp.ubuntu.org. ... %86%8c.pdf