PHP를 사용하기 위해서는 당연히 아파치와 연동해서 사용할 수 있도록 환경 설정을 해주어야 한다. 지난시간에 수정한 httpd.conf가 이러한 역할을 해 준다. 오늘은 아파치의 자동 실행 시 지난시간에 수정한 httpd.conf를 실행하는 실행파일을 손을 볼 것이다.
httpd의 데몬을 실행 시킬 때 쉘 명령어를 통해 몇 가지 옵션을 추가하는 소스로 바꿔줄 것이다.
● /etc/rc.d/init.d/httpd 편집하기
]# cd /etc/rc.d/init.d
]# rm -f httpd
]# vi httpd
===============httpd 파일의 전체 내용을 아래와 같이 입력해 준다.===============
#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /etc/httpd/conf/httpd.conf
# Source function library.
. /etc/rc.d/init.d/functions
if [ -f /usr/local/apache2/bin/envvars ]; then
. /usr/local/apache2/bin/envvars
fi
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
# with the thread-based "worker" MPM; BE WARNED that some modules may not
# work correctly with a thread-based MPM; notably PHP will refuse to start.
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog=httpd
RETVAL=0
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: "
daemon $httpd -k start
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
daemon $httpd -k stop
# killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
daemon $httpd -k restart
# killproc $httpd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start;;
stop)
stop;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac
exit $RETVAL
===========================================================================
:wq
(저장후 단기)
chkconfig --add httpd
서비스 등록한다.
여기까지 진행되면 PHP의 기본 세팅은 끝이 난 것이다. 다음 시간에는 PHP를 사용함에 있어 윤활유 역할을 하는 ZendOptimizer를 설치할 것이다.
그럼 이만....
'개발 서비스 > 메타블로그' 카테고리의 다른 글
[메타블로그 설치기] 제6편 서버 환경 확인하기 (0) | 2009.09.23 |
---|---|
[메타블로그 설치기] 제5편 zend optimizer 설치 (0) | 2009.09.17 |
[메타블로그 설치기] 제4편 PHP 설치 - 2장 환경설정 (0) | 2009.09.09 |
[메타블로그 설치기] 제4편 PHP 설치 - 1장 소스설치 (0) | 2009.09.05 |
[메타블로그 설치기] 제3편 MySQL서버 설치 (0) | 2009.09.04 |