Moderator: General Moderators
First of all, I'm using lampp (xampp for linux) and ubuntu 10.4. In my server, in a directory located in /opt/lampp/htdocs/iris I have a program made in c which I need to execute but, when I do it, system returns an error. I replace that program to another that only has a cout and it returns an error too so the program it's not the problem, is the way that I call it or something like that. I wrote exactly this:
$resultado = system("./main libor ./datos/n4/4.jpg ./datos/n4/4.cod ./datos/n4/4.err);
and in $resultado it returns false so the program fails. I have used umask(0) and chmod("nombrearchivoX",0777) in order to made all the archives that I'm using reachable for all type of users.
I executed the command that I'm passing to system manually and it all goes well!, and I'm in the correct directory because I do a system("ls") and the program is there.
In the same directory, if I write an linux script and I use system("nameofthescript") it all goes well!! why not when I'm using a C++ compiled program??
Why can't I execute the program?, what am I doing wrong??
Thanks for all, all suggestions are welcome.
Also redirect stderr to stdout like this
Code: Select all
$result = system("/directory/command arg1 arg2 2>&1"); var_dump($result);