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