PostgreSQL+PHP+Apache¥¤¥ó¥¹¥È¡¼¥ë †Ãí°Õ»ö¹à †¥Ð¡¼¥¸¥ç¥ó8.1.4, 8.0.8, 7.4.13, 7.3.15°ÊÁ°¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤Ï¥Þ¥ë¥Á¥Ð¥¤¥È½èÍý¤ËSQL¥¤¥ó¥¸¥§¥¯¥·¥ç¥ó¤ÎÀȼåÀ¤¬¤¢¤ê¤Þ¤¹¡£ PostgreSQL¤Î¥¤¥ó¥¹¥È¡¼¥ë †PostgreSQL,PHP,Apache¤ÎRPM¤ÏÁ´¤Æºï½ü¤·¤Æ¤ª¤¤Þ¤¹ postgres ¥æ¡¼¥¶¡¼¤ÎºîÀ® # /usr/sbin/useradd -d /usr/local/pgsql postgres # chmod 755 /usr/local/pgsql ºî¶È¥Ç¥£¥ì¥¯¥È¥êºîÀ® # mkdir /usr/local/src/postgresql-7.4.9 # chown postgres /usr/local/src/postgresql-7.4.9 ¥½¡¼¥¹¼èÆÀ http://www.postgresql.jp/ # su postgres $ tar xvzf postgresql-7.4.9.tar.gz $ cd postgresql-7.4.9 $ ./configure 7.3°Ê¹ß¤Ï¥Þ¥ë¥Á¥Ð¥¤¥È¥µ¥Ý¡¼¥È¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç͸ú¤Ë¤Ê¤ë $ make all $ make check $ make install ¥Ð¡¼¥¸¥ç¥ó¤ò¾å¤²¤ë¤È¥¨¥é¡¼¤¬½Ð¤Æmake check¤¬¤Ç¤¤Ê¤¤¤³¤È¤¬¤¢¤ë # rm -fr /usr/local/pgsql/lib ¤Ê¤É¤È¤·¤Æºï½ü¤·¤Á¤ã¤¤¤Þ¤·¤ç¤¦ contrib´ØÏ¢¤Î¥¤¥ó¥¹¥È¡¼¥ë †Ê̤˥¤¥ó¥¹¥È¡¼¥ëɬÍפϤ¢¤ê¤Þ¤»¤ó $ su postgres $ cd /usr/local/src/postgresql-7.4.9/contrib $ gmake all $ 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-7.4.9/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 Pg.pm¤Î¥¤¥ó¥¹¥È¡¼¥ë †Pg.pm¤Ï7.3¤«¤éÊÌ´ÉÍý¤Ë¤Ê¤Ã¤¿¤½¤¦¤Ê http://gborg.postgresql.org/project/pgperl/download/download.php Pg-2.1.1.tar.gz # tar xvzf Pg-2.1.1.tar.gz # cd Pg-2.1.1 # POSTGRES_HOME=/usr/local/pgsql # export POSTGRES_HOME # perl Makefile.PL # make # make install syslog´ØÏ¢ÀßÄê †$ vi /usr/local/pgsql/data/postgresql.conf log_connections = true # Àܳ¥í¥°¤ò»Ä¤¹ log_statement = true # Á´¤Æ¤ÎSQLʸ¤òµÏ¿ debug_print_parse = true # ¥Ñ¡¼¥¹¥Ä¥ê¡¼¤ò½ÐÎϤ·¤Þ¤¹ debug_print_rewritten = true # ½ñ¤´¹¤¨¸å¤Î¥Ñ¡¼¥¹¥Ä¥ê¡¼¤ò½ÐÎϤ·¤Þ¤¹ debug_print_plan = ture # Ìä¹ç¤»¥×¥é¥ó¤ò½ÐÎϤ·¤Þ¤¹ syslog = 2 # ½ÐÎϤòÀ©¸æ¤·¤Þ¤¹(0:½ÐÎϤʤ· 1:syslog¤Èstdout¤Ë½ÐÎÏ 2:syslog¤Î¤ß¤Ë½ÐÎÏ) syslog_facility = 'LOCAL0' # /etc/rc.d/init.d/postgres restart PostgreSQL¤Î¥í¥°¥Õ¥¡¥¤¥ë¤ÏÊ̤ËÅǤ½Ð¤¹¤è¤¦¤ËÀßÄê $su # vi /etc/syslog.conf local0.* /var/log/postgres # ¾¤Ëlocal0¤ò»È¤Ã¤Æ¤¤¤Ê¤¤¤«Ãí°Õ # ps ax | grep syslog # kill -HUP Ä´¤Ù¤¿syslogd¤ÎPID ¥í¥°¥í¡¼¥Æ¡¼¥·¥ç¥óÀßÄê # vi /etc/logrotate.d/postgres "/var/log/postgres" { rotate 4 weekly sharedscripts postrotate /usr/bin/killall -HUP syslogd endscript } Apache¤Î¥¤¥ó¥¹¥È¡¼¥ë †# tar xvzf apache_1.3.34.tar.gz # cd apache_1.3.34 # OPTIM="-O2" ./configure --enable-module=so --enable-module=rewrite # make # make install Options
AllowOverride
Apache¤Î¥Ð¡¼¥¸¥ç¥ó¤òɽ¼¨¤µ¤»¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤Ë¤Ï httpd.conf ¤Ë¤ª¤¤¤Æ ServerSignature Off ServerTokens ProductOnly ²èÁü¥Õ¥¡¥¤¥ë¤Ï¥í¥°¤ËµÏ¿¤·¤Ê¤¤¤¿¤á¤Ë¤Ï httpd.conf ¤Ë¤ª¤¤¤Æ <IfModule mod_setenvif.c> # no add images log SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" no_log ..... CustomLog /usr/local/apache/logs/access_log combined env=!no_log ¼«Æ°µ¯Æ°¤ÎÀßÄê †# cp /usr/local/apache/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/apache/logs/httpd.pid # config: /usr/local/apache/conf/httpd.conf # /sbin/chkconfig --add httpd # /etc/rc.d/init.d/httpd start ¥í¥°¤Î¥í¡¼¥Æ¡¼¥·¥ç¥óÀßÄê †# vi /etc/logrotate.d/apache /usr/local/apache/logs/*_log { rotate 4 compress # ZIP°µ½Ì¤¹¤ë¾ì¹ç weekly sharedscripts postrotate /usr/local/apache/bin/apachectl restart endscript } # /usr/sbin/logrotate -f /etc/logrotate.d/apache ¥³¥Þ¥ó¥É¤Ë¤Æ /usr/local/apache/logs Æâ¤Ë access_log.1 error_log.1 ¤¬ºîÀ®¤µ¤ì¤Æ¤¤¤ì¤ÐOK PHP4¤Î¥¤¥ó¥¹¥È¡¼¥ë †PHP¤á¤â¤â»²¹Í¤Ë¤·¤Æ²¼¤µ¤¤ # tar xvzf php-4.4.1.tar.gz # cd php-4.4.1 # ./configure --with-pgsql --with-apxs=/usr/local/apache/bin/apxs --enable-zend-multibyte --enable-mbstring --enable-mbregex --enable-mbstr-enc-trans ¤Ï4.3.0°Ê¹ß¤ÏÇÑ»ß GD¤ò»ÈÍѤ¹¤ë¾ì¹ç¤Ï¤³¤ó¤Ê´¶¤¸ # ./configure \ --with-pgsql --with-apxs=/usr/local/apache/bin/apxs \ --enable-zend-multibyte --enable-mbstring --enable-mbregex \ --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 libpng, libjpeg, freetype ¤¬¤Ê¤¤¤È¸À¤ï¤ì¤¿¤é devel ¤òÆþ¤ì¤Æ¤ß¤ë php.ini¤ÎÀßÄê †# cp /usr/local/src/php-4.4.1/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 ;; 4.1.0¤«¤é¿ä¾© register_globals = Off # make # make install httpd.conf¤Î½ñ¤´¹¤¨ †AddType application/x-httpd-php .php ¤òÄɲä·¤ÆApacheºÆµ¯Æ° CGIÈǤò¥¤¥ó¥¹¥È¡¼¥ë¤¹¤ë¾ì¹ç †4.3.0°Ê¹ß¤ÏÉÔÍ× # make distclean # ./configure --with-pgsql --enable-track-vars --enable-force-cgi-redirect --enable-mbstring --enable-mbstr-enc-trans # make # make install ¤³¤ì¤Ç/usr/local/bin/php ¤Ë¥Ð¥¤¥Ê¥ê¤¬¥¤¥ó¥¹¥È¡¼¥ë¤µ¤ì¤ë ¥ß¥Ë¥á¥â †PostgreSQL7.3¤«¤é¤Ï¥Û¡¼¥à¥Ç¥£¥ì¥¯¥È¥ê¤Î .pgpass ¤Ë¡¢ ¥Ç¡¼¥¿¥Ù¡¼¥¹¥Û¥¹¥È¤È¥æ¡¼¥¶¥Ñ¥¹¥ï¡¼¥É¤¬µ½Ò¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¡£ ´Ä¶ÊÑ¿ô PGPASSWORD ¤Ç¤Ï¤Ê¤¯¡¢.pgpass ¤ò»ÈÍѤ¹¤ë¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£ |