I try to run PHP script and to get the ouput from stdout, the code looks like this:
using namespace boost::process;
std::string exec="php";
std::vector<std::string> args;
// I must to throw the exe by argument
args.push_back("php");
args.push_back("a.php");
context ctx;
ctx.stdout_behavior = capture_stream();
child c = launch(exec, args, ctx);
pistream &is = c.get_stdout();
There is no info at stdout, but at stderr I get:
“boost::process::detail::posix_start: execve(2) failed: Permission denied”
And when I run exactly same command in terminal it works fine!
Any solutions?
Thanks..
Thanks @hakre, you gave me right direction!
I went to /usr/bin/ to check the permission and saw php5 command with same permissions as php (php is link to php5).
I don’t understand why, but when I replaced the command to php5, the previous error replaced by: “No such file or directory”, and when I gave full path, it works fine: