LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1025|回复: 0

请教apache调用可执行脚本的问题

[复制链接]
发表于 2006-9-25 21:40:45 | 显示全部楼层 |阅读模式
各位大侠:我的php网页中要调用执行一个可执行脚本,该脚本位于/root/bin目录下,用ls查看其文件属性设置如下(status为文件名):
     -rwsrwsrwx    1 root     root          223  9月 19 22:14 status
打开IE浏览器,点击网页使apache服务器调用执行该脚本,发现网页上出现"assword:",查看系统日志/var/log/messages,其相关的记录为:
Sep 25 17:02:29 test sudo(pam_unix)[19714]: authentication failure; logname= uid=0 euid=0 tty= ruser= rhost=  user=nobody(其中test为主机名).
我想应该是文件权限问题.所以在系统文件/etc/sudoers中加了这么一行:
apache  test = NOPASSWD: /root/bin.但结果还是一样的.请问怎样才能让apache顺利调用/root/bin下的可执行脚本?
  对了,网页中相关的代码为:"<td><span class="s2"><a href=?command=daemon/httpd/status>status of apache</a></span></td>.这条语句和网页中的其他代码协同作用的结果是调用/root/bin/daemon/httpd/status这个脚本.status这个脚本的内容为:
# apache start

#exec service httpd status

#if [ -f /etc/httpd/run/httpd.pid ] ; then
if [ -f /usr/local/apache2/logs/httpd.pid ] ; then
        echo "httpd service is running"
else
        echo "httpd service is stopped"
fi
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表