Hi there,
I'm just writing some PHP code which basically communicates with a C++ program which is compiled on my VPS server.
I am having trouble executing a command with the shell_exec function.
Basically, the code that I am writing is going to be used as one of my own functions.
So I have wrapped it using the
function NameofFunction ($Variables) {
code.
So, when I refer to this function from my other PHP page, it does not execute the shell_exec command.
But I noticed that removing the
function NameofFunction ($Variables) {
makes the shell_exec function work perfectly. I did the test "shell_exec(whoami);" and it returns "apache".
This is my code:
$cmd = $file_path.'program --id '.$userID.' --time 1;
shell_exec($cmd);
Any help is much appreciated. Thanks!