Cannot run Shell script in PHP

Hello,

I have written a code for uploading a file onto the server.The code is as follows:

<? if ($_POST[SubmitB] == "Upload File")
{
if( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],$target) )
{
$tmpsrc = $_FILES['uploadFile'] ['tmp_name'];
echo $tmpsrc."<br>";
sleep(5);

                   //$result = shell_exec\('1.sh -e mysql'\);
                   //fwrite\(STDOUT,$result\);
                   //exit\(0\);
                   //shell_exec\('echo $target'\);
                   //shell_exec\('cat $target'\);
                   ///shell_exec\('sed -e "s/./&,/2" -e "s/./&,/28" $tmpsrc &gt; upload/$outputfile'\);
                   //$cmd='sed -e "s/./&,/2" -e "s/./&,/28"';
                   //shell_exec\($cmd\);

shell_exec('sudo -u root -S sed -e "s/./&,/2" -e "s/./&,/28" $tmpsrc > upload/$outputfile');

//echo shell_exec("1.sh");
//echo "output =".$output."<br>";
echo "cmd =".$cmd."<br>";
echo "result =".$result."<br>";

                   echo "The file &lt;a href=$target&gt;".$_FILES['uploadedFile']['name']. "&lt;/a&gt; has been uploaded";
           \}
   \}
   else
   \{
           echo "sorry, there was a problem uploading your file.";
   \}

?>

The code above is letting me upload the file onto the server, but I am
running a shell script in it, to allow me to edit that file that I have uploaded..
BUt this code is not letting me edit the file..

Is there any function that I should try ?

Please help!!!!

Thanks

I don't use php, I'm relying on perl instead, but what is the error message, and which line is problematical ? The one in red ? Can't you put some error reporting message and see what the problem is ?

The first time you use 'sudo', you have to give the root password ... :rolleyes:

So, I think your script is waiting for the password.

Why do you want to do a 'sudo' ???

NB: "sudo -u root" & "sudo" is the same I think ... :cool: