Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter tatzka

    (@tatzka)

    OK. Checked my php.ini, the line
    disable_functions =
    is empty.

    I finally managed to run an shell_exec from the functions.php and execute a test.php script located under /usr/lib/cgi-bin. I also managed to pass parameters to the php script. This is what I did:
    $command=’php /usr/lib/cgi-bin/testcmd.php ‘.$uniquename.’ ‘.$randompasswd;
    $output = shell_exec($command);

    The code for test.php:

    <?php
    mail(‘myemail@gmai.com’,”Subject: test.php”,”shell_exec works and passes forward”\nUniquename: “.$argv[1].’\nRandompasswd: ‘.$argv[2]);
    $result=shell_exec(‘sudo /usr/bin/mosquitto_passwd -b /etc/mosquitto/passwd ‘.$argv[1].’ ‘.$argv[2]);
    ?>

    The executed test.php does run and send out the email with the passed arguments.
    However the mosquitto_passwd tool does not run. I wonder why not?

    Btw. the test.php has the following access rights:

    pi@server:/usr/lib/cgi-bin $ stat -c “%a %A” test.php
    6711 -rws–s–x

    • This reply was modified 6 years ago by tatzka.
    • This reply was modified 6 years ago by tatzka.
Viewing 1 replies (of 1 total)