• Uncategorized

About php : Running-AMC-auto-multiple-choice-commands-via-php

Question Detail

New to amc auto multiple choice, Automated exam paper based correction I discovered its good functionalities and then decided to build a 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
<?php
    // Get current directory
    echo getcwd() . "<br>";

    // Change directory
    chdir("../amc-mill/ui-scripts");

    // Get current directory
    echo getcwd();
    echo "</br>";
    //**phpdirectamccommandline=Name of the project** **standard=Template**                                                                      
    $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");

?>

RESULT= stopping @ ./02.prepare-subject.sh phpdirectamccommandline”
With Php nothing executed.
With terminal= command successful.

Another attempt:

<?php
    // Get current directory
    echo getcwd() . "&lt;br&gt;";

    // 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();

?>

Conclusion: I checked everything. www-data/whoami/sudoers/chown root/ but I still don’t get any result.

Can some contributor help with clear steps to execute a sequence of bash commands using PHP and check true or false it had been executed. (Remark: Once sequence 2 is executed using the terminal, some files are created. We can see them in the file manager. So no need to get output from.

thanks, everyone.

Question Answer

No answer for now.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.