Forums » Using AMC (english) »
executing amc shell script using php
Added by Gevher Ghazi almost 3 years ago
Hello,
New to amc auto multiple choice, i discovered its good functionalities and then decided to build simple interface in php to launch script commands.
Well, kept reading many topics in forums and found amc-mill.zip which is simplifying procedures.
so , my experience with this stopped at the level below:
1-changed htdocs/www directory to point to folder Projects-QCM
2-extracted amc-mill.zip inside the folder.
3-tested php file:interface.php
<PHPCODE>
// Get current directory
echo getcwd() . "<br>";
// Change directory
chdir("../amc-mill/ui-scripts");
// Get current directory
echo getcwd();
echo "</br>";
//$output = exec("bash ./01.new-project.sh phpdirectamccommandline standard");
$output2 = exec("bash ./02.prepare-subject.sh phpdirectamccommandline");
$output3 = exec("bash ./03.update-marking.sh phpdirectamccommandline");
$output4 = exec("bash ./04.detect-layouts.sh phpdirectamccommandline");
$output5 = exec("bash ./05.print-copies.sh phpdirectamccommandline");
?>
</PHPCODE>
RESULT= stopping @ ./02.prepare-subject.sh phpdirectamccommandline"
With Php nothing executed.
With terminal= command succesfull.
=========================================================
Another attempt:
<PHPCODE>
<?php
// Get current directory
echo getcwd() . "<br>";
// Change directory
chdir("../");
// Get current directory
echo getcwd();
echo "</br>";
//$output = exec("bash ./new-project.sh phpdirectamccommandline");
chdir("phpdirectamccommandline");
$output2 = shell_exec("auto-multiple-choice prepare --mode s --prefix ./ ./source.tex \
--out-sujet DOC-subject.pdf \
--out-corrige DOC-correction.pdf \
--data ./data \
--out-calage DOC-calage.xy");
echo $output2;
echo getcwd();
?>
</PHPCODE>
RESULT= stopping @ ./02.prepare-subject.sh phpdirectamccommandline"
With Php nothing executed.
With terminal= command succesfull.
conclusion : i checked everything. www-data/whoami/sudoers/chown root/
Can some contributor help with steps to do. thanks everyone.
Replies (1)
RE: executing amc shell script using php - Added by Gevher Ghazi almost 3 years ago
Ive adedd 2>&1 ” at the end the shell command :
$output2 = shell_exec("auto-multiple-choice prepare --mode s --prefix ./ ./source.tex 2>&1 \
--out-sujet DOC-subject.pdf \
--out-corrige DOC-correction.pdf \
--data ./data \
--out-calage DOC-calage.xy");
here is the output response: latex: /opt/lampp/lib/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by latex) latex: /opt/lampp/lib/libtiff.so.5: no version information available (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.73) latex: /opt/lampp/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/lib/x86_64-linux-gnu/libpoppler.so.73) Unable to open amc-compiled.amc: No such file or directory at /usr/lib/AMC/perl/AMC-prepare.pl line 326. Output format: dvi /home/user/Projets-QCM/phpdirectamccommandline.
Wonder, how the missing librairies don't throw any conflict while bashing. if so why @terminal everything is executed successfully.
Ill keep updating while testing. Any comment any help would be much appreciated.
(1-1/1)