作者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
1F:推 buganini:shell_exec is identical to backquote 12/05 18:10
2F:→ daniel0523:抱歉,仍不懂你的意思,backquote指的就是shell_exec吗 12/05 18:13
※ 编辑: daniel0523 来自: 140.109.23.212 (12/05 18:16)
4F:→ daniel0523:糟糕,我无法在safe_mode下使用shell_exec 12/05 18:21
5F:→ daniel0523:所以只有把safe_mode改回Off设定罗 Q_Q 12/05 18:23
6F:推 buganini:exec的第二个参数...... 12/05 18:25
7F:→ buganini:不过我会选择关safe_mode PHP6他要废了的样子 12/05 18:25
8F:→ buganini:而且个人觉得带来的麻烦比安全多 安全问题自己处理好 12/05 18:25
9F:→ buganini:就不用依赖safe_mode... 12/05 18:26
10F:推 daniel0523:谢谢你的建议与指教,非常感谢 :) 12/05 18:39