-1
我在某些CGI腳本中收到500錯誤,但沒有收到其他錯誤。不完全確定是什麼導致這個問題,一些援助將不勝感激。某些CGI腳本不會運行
/var/log/apache2/errors.log
[Tue Oct 20 06:12:38.436646 2015] [cgi:error] [pid 12492] [client 65.162.40.26:27886] AH01215: (2)No such file or directory: exec of '/home/rawr/development/hivecontrol/ark/startserver.sh' failed, r$
[Tue Oct 20 06:12:38.437968 2015] [cgi:error] [pid 12492] [client 65.162.40.26:27886] End of script output before headers: startserver.sh, referer: http://arkcontrol.servegame.com/
工程 - messageserver.sh
#!/bin/bash
echo Content-type: text/html
echo
message=$(echo "$QUERY_STRING" | sed -n 's/^.*message=\([^&]*\).*$/\1/p' | sed "s/%20/ /g")
message=${message//+/ }
messageserver $message
echo "<HTML>"
echo "<meta http-equiv='Refresh' content='1; url=../'>"
echo "</HTML>"
不工作 - startserver.sh
#!/bin/bash
echo Content-type: text/html
echo
ark_pid=$(pgrep ShooterGame)
output=$(ls -l /proc/$ark_pid/exe)
echo "<HTML>"
if [[ $output == *ark2* ]];
then
echo "Server is already running"
else
echo "Server didn't appear to be running"
#startark
fi
echo "<meta http-equiv='Refresh' content='1; url=../'>"
echo "</HTML>"
文件權限
[email protected]:~/development/hivecontrol/ark$ ls -l
total 20
-rwxrwxr-x 1 rawr rawr 1544 Oct 20 04:10 index.html
-rwxrwxr-x 1 rawr rawr 357 Oct 20 05:50 killserver.sh
-rwxrwxr-x 1 rawr rawr 272 Oct 20 05:12 messageserver.sh
-rwxrwxr-x 1 rawr rawr 278 Oct 20 04:38 restartserver.sh
-rwxrwxr-x 1 rawr rawr 369 Oct 20 05:56 startserver.sh
刪除LS誤差'輸出= $(ls -l命令的/ proc/$ ark_pid/EXE 2>的/ dev/null的)'和調試'回聲「輸出Output = $ {output}「' –
另外,httpd配置文件是否允許在腳本所在的目錄中執行CGI腳本?選項ExecCGI在那裏列出? –
這是一個許可問題。我解決的最簡單的方法是給www-data組所有權。 – user1023102