apache+php+postgresql

// pgsql编译
tar xzvf posgresql.8.4.xx.tar.gz
cd posgresql.8.4.xx
./configure --prefix=/usr/local/pgsql
make
make install
cd /usr/local/pgsql
mkdir data
chown postgres:postgres data
cd bin
su postgres
./initdb -D ../data --no-locale
pg_ctl start -D ../data
psql
客户端的命令行程序psql有一些以 \d 开头的命令,可显示关于类型,操作符,函数,聚合等信息,使用 \? 可以显示所有可用的命令。
------------------------
pg_hba.conf文件的PG_DATA段可以用IP地址和用户名限制对数据库的连接
# su postgres
$ createuser
Enter name of user to add ---> admin
Enter users postgres ID or RETURN to use unix user ID: 500 ->
Is user "admin" allowed to create databases(y/n) y
Is user "admin" a superuser?(y/n) y
createuser: admin was successfully added
# su postgres
$ destroyuser
Enter name of user to delete ---> admin
destroyuser: delete of user admin was successful.
# su postgres
$ createdb dbname
$ destroydb dbname
// 使用psql操作postgresql数据库
$ psql dbname
Welcome to the POSTGRESQL interative sql monitor:
type ? for help _disibledevent=>
sudo apt-get install postgresql
sudo apt-get install pgadmin3
sudo /etc/init.d/postgresql start
sudo /etc/init.d/postgresql stop
sudo su postgres -c psql template1
ALTER USER posgres WITH PASSWORD 'root';
sudo passwd postgres
su postgres
// sudo su posgres -c createdb mydb
postgres -c createdb mydb
==========================
pgadmin3
127.0.0.1
mydb
root
------------------
/etc/postgres/pg_hba.conf
host all all 127.0.0.1/24 255.255.255.0 password
sudo su postgres -c createuser -D -A -P myuser
sudo su postgres -c create -O myuser mydb
// 第一个命令是创建新用户,这个用户没有创建数据库的权限(-D),没有新建用户的权限(-A),创建此用户时需要输入密码(-P)
// 第二个命令是创建一个数据库'mysql',以'myuser'作为它的所有者
=================================
// apache 编译
tar xzvf httpd-2.0.xx.tar.gz
cd httpd-2.0.xx
./configure --prefix=/usr/local/apache --enable-so
make
make install
cd /usr/local/apache/conf
gedit httpd.conf
<--主要配置User,Group,ServerName,DocumentRoot,DirctoryIndex这些参数
cd /usr/local/apache/bin
./apachectl start
http://localhost
=====================================
// php 编译
tar xzvf php-5.2.xx.tar.gz
cd php-5.2.xx
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-pgsql=/usr/local/pgsql
make
make install
cp php.ini-recommended /usr/local/php/lib/php.ini
gedit /usr/local/apache/conf/httpd.conf
LoadModule php5_module module/libphp5.so
#AddHandler cgi-script.cgi
AddType application/x-httpd-php .php
./apachectl restart
=======================================
Tags: 

延伸阅读

最新评论

发表评论