Why is it possible to execute a command in the script using exec and put it in the command line of the server? I also configured it in/etc/sudoers & nbsp; & nbsp; I first made the following configuration in/etc/sudoers & nbsp; then restarted the apache Server & nbsp; why is it possible to execute a command in the script using exec and put it on the server command line? I also configured it in/etc/sudoers.
I first made the following configuration in/etc/sudoers:
Restart the apache server.
Written in the tp framework
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');
After the code is run, it is ineffective and transcoding fails. you can execute the code directly.
At the same time, I wrote the transcoding part to a shell script.
#!/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
Call through exec
exec("sudo ./bash turnCode $save_path1:$file_path1", $out, $status);
The results still cannot be transcoded. I am very grateful to anyone who has received this article !!! Shell share:
------ Solution --------------------
The command line uses the permissions of your account. Scripts can be different, and are completely controlled by the account permissions of the script owner or creator.