简体   繁体   中英

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.

$test = `svn cat ....`

header("Content-Disposition: attachment; filename=" . urlencode($filename));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer"); 

echo $test;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM