Jump to content

php exec/shelll_exec


map200uk

Recommended Posts

hi,

 

bit confused at present,

 

if i do

 

$output = shell_exec('ln');

echo "<pre>$output</pre>";

 

i get no result

 

but yet for df-h / uptime/whoami/ ls -art etc a result is shown

 

ive checked the user 'nobody' and it has permission to run the ln command? so surely i should get some kind of response

 

 

Link to comment
https://forums.phpfreaks.com/topic/49975-php-execshelll_exec/
Share on other sites

As the previous poster suggested ln cannot be run without arguments.  If you type ln into the console you'll get

 

 

ln: missing file argument

Try `ln --help' for more information.

 

 

However this is sent to std error not std out.  I believe exec only returns output piped through std out.

 

Best,

 

Patrick

Link to comment
https://forums.phpfreaks.com/topic/49975-php-execshelll_exec/#findComment-245558
Share on other sites

ahh right ok a boolean value yea, no output tho i meant

 

could someone help with a problem with exec-when i use exec to create sym links the script NEVER finished

 

function findMusic($dir) {

    $musicList = array();

    $dirHandle = opendir($dir);

    $dir2 = "/opt/lampp/htdocs//mp3";

 

  //  echo "<br> DIRECTOR IS \n $dir";

    while (($file = readdir($dirHandle)) !== FALSE) {

          if ($file == "." || $file == "..") continue;

          if (is_dir($dir . "/" . $file)) $musicList = array_merge($musicList, findMusic($dir . "/" . $file));

          else {

              $extension = end(explode(chr(46), $file));

                          // print $extension;

              if (strtolower($extension) == "mp3") { $musicList[] = $dir . "/" . $file; }

 

        echo "<br>mp3 found in \n $dir";

        echo "<br>commnd is \n $command";

        echo "attempting to create some sym links";

//      shell_exec("ln -s $dir $dir2");

 

}

 

 

}

 

        closedir($dirHandle);

    return $musicList;

}

Link to comment
https://forums.phpfreaks.com/topic/49975-php-execshelll_exec/#findComment-245646
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.