has anyone got shell_exec() to actually generate output?

i've read the manual at php.net, and i can't get any of the examples to work.

for example:

<?
$output=shell_exec("rm /bad/path/to/file");
echo $output;
?>

i think this should generate the error that the shell should output.

let me use another example. i have a shell script named "script.sh"

echo "this is the output from script.sh"

i have made this script executable, then i try a similar script to the first php example:

<?
$output=shell_exec("script.sh");
echo $output;
?>

i'm still not getting anything in my php script. both the directory and the shell script have execute permissions for everyone.

any ideas?

    Try this instead of shell_exec(). Those are backticks, the same key as the tilda ~

    $output=`rm /bad/path/to/file`;
    echo $output;
    

      Are you sure that your php script can find script.sh? Have you tried the same command with full path?

        Write a Reply...