CentOS4 に apache2 + PHP4 + PostgreSQL8.3
前回の続きです
OS | CentOS 4.7 | |
---|---|---|
apache | 2.0.52 | yumで取得した最新版 |
php | 4.3.9 | yumで取得した最新版 |
postgreSQL | 7.4.19 | yumで取得した最新版 |
apache(httpd)インストール
確認
ブラウザで「httpd://192.168.10.236(サーバのアドレス)」にアクセスして
が表示されればOK
参考
設定ファイルの場所/etc/httpd/conf/httpd.conf
PHPインストール
公開ディレクトリに下記のファイルを作成し動作するか確認。
# yum install -y php php-pear php-mbstring
<html>
<head>
<title>php test</title>
</head>
<body>
<h1>php test</h1>
<hr>
<?php
print "Hello World Php Programing!!";
?>
</body>
</html>
このように表示されればOK。
PostgreSQLのインストール
PostgreSQLのインストール ⇒ スタート&初期化 ⇒ 自動起動設定ON
# yum -y install postgresql-server
# /etc/rc.d/init.d/postgresql start
# chkconfig postgresql on
postgreSQL管理ユーザであるpostgres(インストール時に作成される)で通常DBを使用するuser01(OSのuserとしても作成されていること)を作成。
DBのリストを表示させることができればOK
# su postgres -
$ createuser -P user01
Enter password for new user:***
Enter it again:***
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) y
CREATE USER
$ exit
# su user01 -
$ psql -l
List of databases
Name | Owner | Encoding
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(2 rows)
$サイトでDBのデータを使用できるようにPHPでpostgresqlをできるようモジュールをインストールする。
$ su -
# yum install -y php-pgsql
# /etc/rc.d/init.d/httpd restart