/    Sign up×
Community /Pin to ProfileBookmark

shell_exec not working with dynamic commands

<?php
ini_set(‘max_execution_time’, 864000);
$seq = “D:/Ractip/Sequence.txt”;
$mir = “D:/Ractip/mirhominid.txt”;
$shandle = fopen($seq, ‘r’);
$sdata = fread($shandle, filesize($seq));
$mhandle = fopen($mir, ‘r’);
$mdata = fread($mhandle, filesize($mir));
$sexp = explode(“>”, $sdata);
$mexp = explode(“>”, $mdata);
$i = 1;
$a = 1;
$count = count($sexp);

while($i < $count)
{
$name = explode(“n”, $mexp[$a]);
$name = explode(” “, $name[0]);
$name1 = explode(“n”, $sexp[$i]);

$file2 = “D:Ractipmir“.”$name[1]”.”.txt”;
$file1 = “D:Ractipsequence“.”name1[0]”.”.txt”;

if ($i == 1)
{
mkdir(“D:/Ractip/Interactions/”.”$name[1]”, 0777);
}
$file = “D:/Ractip/Interactions/”.”$name[1]”.”/”.”$name1[0]”.”+”.”$name[1]”.”.txt”;
$fhandle = fopen($file, ‘w’);
$query = “ractip “.”$file1″.”.txt”.” “.”$file2″.”.txt”;

$exec = exec($query);
print $exec;
fwrite($fhandle, $exec);
fclose($fhandle);
if ($i == $count)
{
$i = 1;
$a++;
}
else
{
$i++;
}
}

?>

this is the script, i am basically using a tool to get results of roughly 37.5 million combinations, so as u can understand it isn’t something that i can do on my own, therefore came along this script, previously i separated all candidates into individual files and so that is the explanation for the $name variables im calling them that way.

The problem is the shell_exec command, a preliminary google search really did not explain why it is behaving this way, but shell_exec refuses to process dynamic commands, instead if i were to make a static command like “ractip xy.txt zy.txt” it will process that, what i need to do is build the command and then make the shell_exec process it, which it unfortunately isn’t doing.

to post a comment
PHP

0Be the first to comment 😎

×

Success!

Help @kipal spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...