■ Apache のインストール 2001/06/10
# mkdir /usr/local/src/apache
# cd /usr/local/src/apache
# tar xfz ./apache_1.3.19.tar.gz
# cd apache_1.3.19.tar.gz
# env OPTIM="-O2" ./configure --enable-module=so
# make
# make install
■ PHP のインストール 2001/06/10
# mkdir /usr/local/src/php
# cd /usr/local/src/php
# tar xfz ./php-4.0.5.tar.gz
# cd php-4.0.5
# ./configure --with-pgsql --enable-track-vars
--with-apxs=/usr/local/apache/bin/apxs --inable-i18n --enable-mbregex
# make
# make install
※ PHP の再インストール(ver.4.2.2) 2002/09/08
(上記との違い)
# ./configure --with-pgsql --enable-track-vars
--with-apxs=/usr/local/apache/bin/apxs --enable-mbregex
(不用:--inable-i18n)
※ /usr/local/lib/php.ini の作成(デフォルトの設定なら ini ファイルは無い)
$ cat php.ini
; 論理値は次のどれかとなります:
; true, on, yes
; または false, off, no, none
register_globals = on
(理由)
Q. a href='detail.php?mid=$str' のように、変数を渡しているが、
渡らなくなっている(ver.4.2以降)
A. PHPが4.2.1にアップされて reguster_globals = off
に設定されているから
■ /usr/local/apache/conf/httpd.conf 編集
以下の行のコメント(#)を外し、有効にする
LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
以下の行に index.php を追加
DirectoryIndex index.html index.php
■ /etc/ld.so.conf 編集
以下の行を追加
/usr/local/pgsql/lib
( httpd.conf 内で設定した libexec/libphp4.so へのパスを通す)
この設定の反映
# ldconfig
■ Apache の自動起動
/etc/rc.d/init.d の下位に httpd 作成
(作成とはいっても、以前 rpm インストール時にできてたものを編集)
$ cat /etc/rc.d/init.d/httpd
----ここから
#!/bin/sh
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# config: /usr/local/apache/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
echo -n "Starting httpd: "
daemon /usr/local/apache/bin/httpd # 編集箇所
echo
touch /var/lock/subsys/httpd
;;
stop)
echo -n "Shutting down http: "
killproc httpd
echo
rm -f /var/lock/subsys/httpd
rm -f /var/run/httpd.pid
;;
status)
status httpd
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reloading httpd: "
killproc httpd -HUP
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac
exit 0
----ここまで
■ PHP3 から PHP4 への移行
1.拡張子の変更
( *.php3 ---> *.php )
2.
function で connect() は使用不可(恐らく予約語)
---> connection() とした
----------------------------------------------------------------------------
| pc-unix | toppage |