apach2+postgresql8+php5の環境を作る。

Apache入れるyum

cd /etc/yum.repos.d/ 
wget http://centos.karan.org/kbsingh-CentOS-Extras.repo 

dag.repoを作って

[dag]
name=Dag RPM Repository for Fedora Core
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el$releasever/en/$basearch/dag
enabled=1
gpgcheck=1
yum install httpd
yum install httpd-devel
yum install mcrypt
yum install libmcrypt

postgres8をrpmで入れる

http://ftp2.jp.postgresql.org/pub/postgresql/binary/v8.3.0/linux/rpms/redhat/rhel-4-i386/
から
postgresql-8.3.0-1PGDG.rhel4.i686.rpm

postgresql-libs-8.3.0-1PGDG.rhel4.i686.rpm

postgresql-devel-8.3.0-1PGDG.rhel4.i686.rpm

postgresql-server-8.3.0-1PGDG.rhel4.i686.rpm
落として

rpm -e postgresql-python-7.4.19-1.el4_6.1 postgresql-docs-7.4.19-1.el4_6.1 postgresql-libs-7.4.19-1.el4_6.1 postgresql-server-7.4.19-1.el4_6.1 postgre
sql-odbc-7.3-8.RHEL4.1 postgresql-devel-7.4.19-1.el4_6.1 postgresql-tcl-7.4.19-1.el4_6.1 postgresql-contrib-7.4.19-1.el4_6.1 postgresql-7.4.19-1.el4_6
.1 postgresql-pl-7.4.19-1.el4_6.1 postgresql-test-7.4.19-1.el4_6.1 postgresql-jdbc-7.4.19-1.el4_6.1

で消して

rpm -iv postgresql*

で、いれる。

rpmで入れる。

PHPを入れる

php-5.2.5.tar.bz2

tar jxvf php-5.2.5.tar.bz2

jオプション

他の鯖のconfigureオプション

php -i | grep config
Configure Command =>  './configure' '--with-apxs2=/usr/local/sbin/apxs' '--with-pgsql' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-mcrypt'

でインストールして
httpd.confに

AddType application/x-httpd-php .php

を足す

( ゚Д゚)ウマー

homeディレクトリ以下にvirtualhostを作りたいとき

/home/crimaru/dev/rails/プロジェクト名
とかで開発してることが多いので、
/home/crimaru/dev/php/プロジェクト名/www
をドキュメントルートにしたい

#<Directory /home/*/public_html>
<Directory /home/*>
    AllowOverride FileInfo AuthConfig Limit
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    <Limit GET POST OPTIONS>
        Order allow,deny
        Allow from all
    </Limit>
    <LimitExcept GET POST OPTIONS>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

#中略

<VirtualHost 192.168.xx.xxx:80>
    ServerName プロジェクト名
    DocumentRoot /home/crimaru/dev/php/hogehoge/www
    ErrorLog logs/project_name.com-error_log
    CustomLog logs/project_name-access_log combine
</VirtualHost>

で、homeディレクトリがDefaultで700になってたので
705にしちゃる。

[root@localhost crimaru]# ls -ld
drwx------  7 crimaru crimaru 4096  2月 22 14:59 .

[root@localhost crimaru]# chmod 705 .
[root@localhost crimaru]# ls -ld
drwx---r-x  7 crimaru crimaru 4096  2月 22 14:59 .

AllowOverride All

.htaccessきくようにしる

AllowOverride All

で、httpdリスタート