PostgreSQL8+PHP5+Apache2¥¤¥ó¥¹¥È¡¼¥ë

PostgreSQL8.0¤Î²òÀâ

PostgreSQL¤Î¥¤¥ó¥¹¥È¡¼¥ë

PostgreSQL,PHP,Apache¤ÎRPM¤ÏÁ´¤Æºï½ü¤ª¤­¤Þ¤¹
¥Ð¡¼¥¸¥ç¥ó¥¢¥Ã¥×¤¹¤ë¾ì¹ç¤Ï¥Ð¥Ã¥¯¥¢¥Ã¥×¤ò¼è¤Ã¤Æ»ß¤á¤Æ¤ª¤­¤Þ¤·¤ç¤¦

postgres ¥æ¡¼¥¶¡¼¤ÎºîÀ®

# /usr/sbin/useradd -d /usr/local/pgsql postgres
# chmod 755 /usr/local/pgsql

ºî¶È¥Ç¥£¥ì¥¯¥È¥êºîÀ®

# mkdir /usr/local/src/postgresql-8.1.0
# chown postgres /usr/local/src/postgresql-8.1.0

¥½¡¼¥¹¼èÆÀ http://www.postgresql.jp/

# su postgres
$ tar xvzf postgresql-8.1.0.tar.gz
$ cd postgresql-8.1.0
$ ./configure
$ gmake
$ gmake check
$ gmake install

¥Ñ¥¹¤ÎÀßÄê

postgres¤ÈPostgreSQL¤ò»ÈÍѤ¹¤ë¥æ¡¼¥¶¡¼Á´¤Æ¤Î.bashrc¤Ë°Ê²¼¤òÄɲÃ

PATH="$PATH":/usr/local/pgsql/bin
export POSTGRES_HOME=/usr/local/pgsql
export PGLIB=$POSTGRES_HOME/lib
export PGDATA=$POSTGRES_HOME/data
export MANPATH="$MANPATH":$POSTGRES_HOME/man
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"$PGLIB"

ÀßÄê¤ÎÈ¿±Ç

$ source ~/.bashrc

¥Ç¡¼¥¿¥Ù¡¼¥¹½é´ü²½

$ initdb --encoding=EUC_JP --no-locale

°ì¹ÔÄɲÃ

# vi /etc/ld.so.conf
/usr/local/pgsql/lib
# /sbin/ldconfig

¼«Æ°µ¯Æ°¤ÎÀßÄê

# cp /usr/local/src/postgresql-8.1.0/contrib/start-scripts/linux /etc/rc.d/init.d/postgresql
# chmod 755 /etc/rc.d/init.d/postgresql
# /sbin/chkconfig --add postgresql
# /etc/rc.d/init.d/postgres start

Apache¤Î¥¤¥ó¥¹¥È¡¼¥ë

http://www.apache.or.jp/

# tar xvzf httpd-2.0.55.tar.gz
# cd httpd-2.0.55
# ./configure --with-mpm=worker --enable-rewrite
# make
# make install

Apache¤Î¥Ð¡¼¥¸¥ç¥ó¤Ê¤É¤òɽ¼¨¤µ¤»¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï httpd.conf ¤Ë¤ª¤¤¤Æ

ServerSignature Off
ServerTokens Prod

¼«Æ°µ¯Æ°¤ÎÀßÄê

# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
# chmod 755 /etc/rc.d/init.d/httpd
# vi /etc/rc.d/init.d/httpd

°Ê²¼¤òÄɲÃ

#!/bin/sh
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#              HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache2/logs/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf
# /sbin/chkconfig --add httpd
# /etc/rc.d/init.d/httpd start

¥í¥°¤Î¥í¡¼¥Æ¡¼¥·¥ç¥óÀßÄê

# vi /etc/logrotate.d/apache
/usr/local/apache2/logs/*_log
{
  rotate 4
  compress # ZIP°µ½Ì¤¹¤ë¾ì¹ç
  weekly
  sharedscripts
  postrotate
  /usr/local/apache2/bin/apachectl restart
  endscript
}
# /usr/sbin/logrotate -f /etc/logrotate.d/apache

¥³¥Þ¥ó¥É¤Ë¤Æ /usr/local/apache2/logs Æâ¤Ë access_log.1 error_log.1 ¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤ì¤ÐOK

PHP5¤Î¥¤¥ó¥¹¥È¡¼¥ë

PHP¤á¤â¤â»²¹Í¤Ë¤·¤Æ²¼¤µ¤¤ :D

Amazon ECS¤Ê¤É¤òÍøÍѤ¹¤ë¾ì¹ç¤ÏSimpleXML´Ø¿ô¤òÍ­¸ú¤Ë¤·¤Æ¤ª¤¯
--enable-simplexml

cURL¤òÍøÍѤ¹¤ë¾ì¹ç¤ÏÀè¤Ë¥¤¥ó¥¹¥È¡¼¥ë¤·¤Æ¤ª¤¯
--with-curl

# tar xvzf php-5.0.5.tar.gz
# cd php-5.0.5
# ./configure --with-pgsql --with-apxs2=/usr/local/apache2/bin/apxs \
--enable-zend-multibyte --enable-mbstring --with-gd \
--with-zlib-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr \
--with-freetype-dir=/usr --with-ttf --enable-gd-native-ttf \
--enable-gd-jis-conv --enable-simplexml --with-curl

php.ini¤ÎÀßÄê

# cp /usr/local/src/php-5.0.5/php.ini-dist /usr/local/lib/php.ini
;; ½ÐÎϥХåե¡¥ê¥ó¥°¤òÍ­¸ú¤Ë¤¹¤ë
output_buffering = On 

;; mb_output_handler¤Ë¤è¤ë½ÐÎÏÊÑ´¹¤òÍ­¸ú¤Ë¤¹¤ë 
output_handler = mb_output_handler

;; HTTP¥Ø¥Ã¥À charset ¤òÀßÄê
default_charset = Shift_JIS

;;ÆüËܸì¼çÂΤǻÈÍÑ
mbstring.language = Japanese

;; ÆâÉô¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤òEUC-JP¤ËÀßÄê
mbstring.internal_encoding = EUC-JP 

;; HTTPÆþÎÏ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°ÊÑ´¹¤òauto¤ËÀßÄê
mbstring.http_input = auto 

;; SJIS¤ËÊÑ´¹
mbstring.http_output = SJIS

mbstring.encoding_translation = On
mbstring.detect_order = auto
 
;; ̵¸ú¤Êʸ»ú¤ò½ÐÎϤ·¤Ê¤¤
mbstring.substitute_character = none;

mbstring.func_overload = 0
# make
# make install

httpd.conf¤Î½ñ¤­´¹¤¨

AddType application/x-httpd-php .php

¤òÄɲä·¤ÆApacheºÆµ¯Æ°


¥È¥Ã¥×   ¿·µ¬ °ìÍ÷ ¸¡º÷ ºÇ½ª¹¹¿·   ¥Ø¥ë¥×   ºÇ½ª¹¹¿·¤ÎRSS