![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To call/execute a shell script from a shell script | konark | UNIX for Dummies Questions & Answers | 1 | 10-26-2007 02:16 PM |
| How to pass a parameter from one Shell-script to another Shell-script | subodhbansal | Shell Programming and Scripting | 2 | 09-22-2007 02:19 AM |
| How to Run a shell script from Perl script in Parent shell? | hifake | Shell Programming and Scripting | 16 | 08-28-2007 05:42 PM |
| Accessing variables of one shell script in another shell script | rsendhilmani | Shell Programming and Scripting | 1 | 04-30-2007 05:43 AM |
| Have a shell script call another shell script and exit | heprox | Shell Programming and Scripting | 2 | 11-20-2006 05:17 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 > 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 <a href=$target>".$_FILES['uploadedFile']['name']. "</a> 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 |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
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 ?
|
|
#3
|
|||
|
|||
|
The first time you use 'sudo', you have to give the root password ...
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 ... |
|||
| Google The UNIX and Linux Forums |