Problem with executing a command from within my script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike Gaskins

    Problem with executing a command from within my script

    I'm working on a web-based mail quarantine management system, and am
    running into some problems getting it to run the command to release a
    message.

    The main exertp of the script is below:

    <?php

    echo "Releasing /var/amavis/quarantine/" . $_POST['release'] . " to
    user " . $_POST['user'] . "<br><br>";
    $command = "/usr/sbin/amavisd-release " . $_POST['release'] . " " .
    $_POST['secretid'];
    echo $command . "<br>";
    passthru($comma nd, $return_val);
    echo "<br>" . $return_val;
    ?>

    End script

    This command works fine from the command line, but won't run using this
    code. It comes back with a return code of 13 each time. I've also
    tried the exec and popen functions in place of passthru() with no luck.
    If it matters any, amavisd-release is an executable Perl script.

    Any ideas?

    Mike Gaskins

  • Andy Hassall

    #2
    Re: Problem with executing a command from within my script

    On 24 Jul 2006 13:36:08 -0700, "Mike Gaskins" <mbgaski@clemso n.eduwrote:
    >I'm working on a web-based mail quarantine management system, and am
    >running into some problems getting it to run the command to release a
    >message.
    >
    >The main exertp of the script is below:
    >
    ><?php
    >
    > echo "Releasing /var/amavis/quarantine/" . $_POST['release'] . " to
    >user " . $_POST['user'] . "<br><br>";
    > $command = "/usr/sbin/amavisd-release " . $_POST['release'] . " " .
    >$_POST['secretid'];
    > echo $command . "<br>";
    > passthru($comma nd, $return_val);
    > echo "<br>" . $return_val;
    >?>
    >
    >End script
    >
    >This command works fine from the command line, but won't run using this
    >code. It comes back with a return code of 13 each time. I've also
    >tried the exec and popen functions in place of passthru() with no luck.
    If it matters any, amavisd-release is an executable Perl script.
    The meaning of return codes depends on context, but if it was raised by the OS
    then 13 matches "Permission denied", and that seems fairly likely. The user and
    environment will be quite different between your command line and the webserver
    environment.

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    Working...