i'm trying to execute a program from my php. I want to execute it and pass it a variable, i've tried using exec($cmd, $op) but the array of $op doesn't have the output within it (or anything else).

Should i be using a different function to get this working? any help would be much appreciated.

n.b. safe mode is de-activated.

This is the code i'm now using still not producing any results.

[INDENT]
<?php

$cmd = "./programs/x /images/y.jpg";
unset($op);

$op = shell_exec($cmd);
//echo $cmd;
//echo "there should be something here";
echo($op);

?>
[/INDENT]

What is the expected output? Also, go to where the script is and execute that command by hand, what do you get?

the exec() command was giving me only the last line of the expected output for some reason.

but it was a very simple change that made the shell_exec work, was as easy as changing the "/image/..." to "./image/..."

thanks for the help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.