void Posted August 12, 2008 Share Posted August 12, 2008 Hi there, i've got a problem with shell_exec(). the function itself works just fine, but i can't get it to execute a c++ compiled file. what i'm trying to do is running shell_exec("./program.out"), but it returns no output, not even an error or some kind. the script doesn't do it's job, also. What could possibly be wrong? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/ Share on other sites More sharing options...
jonsjava Posted August 12, 2008 Share Posted August 12, 2008 could be a permissions issue on the binary. If that's not it, try running it this way: shell_exec("sh ./program.out"); Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/#findComment-614485 Share on other sites More sharing options...
void Posted August 12, 2008 Author Share Posted August 12, 2008 thanks for reply. what permission issue could it be? i chmod'ed everything 777, but that didn't help. commands such as `mkdir` work fine. no, sh ./program.out doesn't work. even in ssh, it gives `cannot execute binary file` error. any other ideas?.. Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/#findComment-614560 Share on other sites More sharing options...
trq Posted August 12, 2008 Share Posted August 12, 2008 Are you echo'ing the return value of shell_exec? it returns a string, doesn't output it. Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/#findComment-614616 Share on other sites More sharing options...
discomatt Posted August 12, 2008 Share Posted August 12, 2008 no, sh ./program.out doesn't work. even in ssh, it gives `cannot execute binary file` error. That might be teh issue Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/#findComment-614647 Share on other sites More sharing options...
void Posted August 12, 2008 Author Share Posted August 12, 2008 Are you echo'ing the return value of shell_exec? it returns a string, doesn't output it. yes, i understand, i'm echo'ing it. Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/#findComment-614734 Share on other sites More sharing options...
void Posted August 12, 2008 Author Share Posted August 12, 2008 no, sh ./program.out doesn't work. even in ssh, it gives `cannot execute binary file` error. That might be teh issue are you sure? but the `./program.out` works just fine! where should i search for the error message, if it doesn't execute my file? Link to comment https://forums.phpfreaks.com/topic/119289-executing-binaries-with-shell_exec/#findComment-614738 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.