PHP returns not found on binary file exec

I’m trying to implement the script call to a binary file on script access.
So, the problem is that instead of executing a file, php reports an error: not found.

This is the code of script:
$plugin_name = “sounds”;

$cmd = "./spcomp $plugin_name.sp -o $plugin_name.smx";
shell_exec($cmd);
if(is_resource("$path_to_compiler/$plugin_name.smx")) { echo "success"; }

spcomp is located next to sounds.sp (php script aswell) (these are sourcemod files btw, you need the linux branch if you want to look inside). I can execute these files separately, but not using php.
This is what I get when script is trying to exec $cmd:
[Sat Aug 01 11:24:19 2015] [error] [client *.*.*.*] sh: 1: ./spcomp: not found
sh is the working folder.
The bin isn’t corrupted, it is 775 and I am able to run it via terminal.

So, what’s wrong with it?

Tried:

  • all sorts of shell execution
  • absolute paths
  • cwd change
  • different functions (the same result)
  • shebang for the $cmd

And nothing of this worked.

Thank you.


Source: shell

Leave a Reply