2 xw597323124 xw597323124 于 2014.02.27 09:41 提问

red hat5搭建apache环境完成后无法启动httpd,脚本报错

最近学习在red hat5上web程序设计,在搭建LAMP源码环境搭建WEB服务Linux+Apache+MySQL+PHP的时候,按照http://www.linuxidc.com/Linux/2013-05/84882.htm的步骤进行。
但是到了安装apache时,已经将httpd安装完成,而且按照该网页的步骤写一个httpd启动脚本,但是始终没法启动hpptd。该脚本如下:
#!/bin/sh
#set -x
HTTPD='/usr/local/apache/bin/httpd'

CONFFILE='/etc/httpd/httpd.conf'

#description: http server

#chkconfig: 2345 88 60

start(){

[ -f /var/lock/subsys/httpd ]&& echo "apache is started" && exit

echo -n "starting apache......"

sleep 1

}

stop(){

[ ! -f /var/lock/subsys/httpd ] && echo "httpd is stoped..." && exit

echo -n "stoping httpd........"

sleep 1

/bin/rm -rf /var/lock/subsys/httpd

$HTTPD -k stop && RETVAL=0 ||RETVAL=1

}

case $1 in

stop(){

[ ! -f /var/lock/subsys/httpd ] && echo "httpd is stoped..." && exit

echo -n "stoping httpd........"

sleep 1

/bin/rm -rf /var/lock/subsys/httpd

$HTTPD -k stop && RETVAL=0 ||RETVAL=1

[ $RETVAL -eq 0 ] && rm -rf /var/lock/subsys/httpd && echo "ok" || echo "fail"

}

case $1 in

start)

start

;;

stop)

stop

;;

restart)

stop

start

;;

*)

echo "start|stop|restart"

;;

esac

每一次我照输入service httpd start时候,都是报错

/etc/init.d/httpd: line 39: syntax error near unexpected token `('

/etc/init.d/httpd: line 39: `stop(){'
而我安装httpd使用的命令是:[root@lly httpd-2.4.4]# ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-rewrite --with-apr=/usr/local/apr/bin/apr-1-config --with-apr-util=/usr/local/apr/bin/apu-1-config --with-pcre -with-z --enable-mpms-shared=all
完全按照那个讲解了……

请教各位大神!!!这个错误怎么改???

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!