作者daniel0523 (Daniel)
看板PHP
標題[請益] Cannot execute using backquotes in Safe Mode
時間Wed Dec 5 17:56:43 2007
為了利用php執行內部一個程式
設定 safe_mode 為 On,
並把 safe_mode_exec_dir 設定為外部程式所在的資料夾內,
程式可以順利執行,但是跑出了以下訊息
Warning: shell_exec() [function.shell-exec]: Cannot execute using
backquotes in Safe Mode
擷取那一段程式區塊
function get_system_date() {
$command = "stat ".$_SERVER["SCRIPT_FILENAME"]."|grep Modify";
$str =
shell_exec($command);
// Trim Modify:
$str = substr($str,8);
$str_explode = explode(" ",$str);
$res_str = $str_explode[0];
return($res_str);
}
//end of function get_system_date()
搜尋了網路上相關解決辦法,大部分是由於 (`)倒單引號符號所致,
可是我並沒有使用此符號,其二或是把 safe_mode改回 Off 可以解決此問題。
請問各位,有其他解決辦法嗎? 謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.109.23.212
推 buganini:shell_exec is identical to backquote 12/05 18:10
→ daniel0523:抱歉,仍不懂你的意思,backquote指的就是shell_exec嗎 12/05 18:13
※ 編輯: daniel0523 來自: 140.109.23.212 (12/05 18:16)
→ daniel0523:糟糕,我無法在safe_mode下使用shell_exec 12/05 18:21
→ daniel0523:所以只有把safe_mode改回Off設定囉 Q_Q 12/05 18:23
推 buganini:exec的第二個參數...... 12/05 18:25
→ buganini:不過我會選擇關safe_mode PHP6他要廢了的樣子 12/05 18:25
→ buganini:而且個人覺得帶來的麻煩比安全多 安全問題自己處理好 12/05 18:25
→ buganini:就不用依賴safe_mode... 12/05 18:26
推 daniel0523:謝謝你的建議與指教,非常感謝 :) 12/05 18:39