为什么用exec执行一个命令时,在脚本内执行不成功,放到服务器命令行就可以了,我在/etc/sudoers也做了配置
我首先在/etc/sudoers做了如下配置
接着重启了下apache服务器
在tp框架内写到
exec('/usr/bin/unoconv --server localhost --port 8100 -o /usr/local/webserver/www/server/Exam/Public/Uploads/Resource/transform/document/201309/52419a788a553.pdf -f pdf /usr/local/webserver/www/server/Exam/Public/Uploads/Resource/untransform/document/201309/52419a788a553.doc');
#!/bin/sh
turnCode() {
local pdf=`echo $1 | cut -d: -f1`;
local file=`echo $1 | cut -d: -f2`;
echo $pdf;
echo $file;
`/usr/bin/unoconv --server localhost --port 8100 -o $pdf -f pdf $file`
}
action="$1"
setting="$2"
case $action in
turnCode)
turnCode "$setting"
;;
*)
;;
esac
exec("sudo ./bash turnCode $save_path1:$file_path1", $out, $status);