Why is it possible to execute a command in the script using exec and put it on the server command line? I also configured shell in etcsudoers.
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/shturnCode() {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 !!!
Reply to discussion (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.
Oh, it's done.
1. configure mongodo to set permissions for apache users.
Comment out Defaults requiretty
Add www ALL = (ALL) NOPASSWD: ALL
2. restart the apache service/usr/local/webserver/apache2/bin/apachectl restart.