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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.