02-08-2008
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
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Perl/UNIX experts,
I have a problem in running a shell script from my perl script (auto.pl).
I run the perl script using
perl auto.pl
from the shell prompt
The shell script picks the files in "input" folder and procesess it.
The shell script blue.sh has this code.
export... (16 Replies)
Discussion started by: hifake
16 Replies
2. Shell Programming and Scripting
Hi.
I write a shell script for import data to oracle using sql loader.
I set permission 755 or 777 for that script. I can run that script in the consol okay.
When I call it from PHP using system command. I got return value 126 this value when don't have permission right ?
I check step... (2 Replies)
Discussion started by: raccsdl
2 Replies
3. UNIX for Dummies Questions & Answers
Hello All!
I am looking to build a monitoring script.
The script should always run as a system service of some type and should always check that a PHP script is running.
Maybe there is a way to assign a PHP script to a certain PID so that the monitor script that check for the PID in top... (4 Replies)
Discussion started by: elDeuce
4 Replies
4. Shell Programming and Scripting
i have a small problem getting a batxh shell script to run in shell
this is the code
the problem seems to be centered around the ffmpeg command, something maybe to do with the ' ' wrapping around the vhook part command
this is a strange problem , if i take the ffmpeg command and... (1 Reply)
Discussion started by: wingchun22
1 Replies
5. Shell Programming and Scripting
Status quo is, within a web application, which is coded completely in php (not by me, I dont know php), I have to fill out several fields, and execute it manually by clicking the "go" button in my browser, several times a day.
Thats because:
The script itself pulls data (textfiles) from a... (3 Replies)
Discussion started by: lowmaster
3 Replies
6. Shell Programming and Scripting
Is it possible to dry run a php script without actually executing it? Say I need to test the output of a php file to see if it matches a pattern. I need to run this on all php files on the server. But I fear if there are php files that make modifications, sends out mail etc, that should not happen.... (1 Reply)
Discussion started by: anilcliff
1 Replies
7. Shell Programming and Scripting
Hi I m running a php file in Unix shell
it says php cpmmnad not found
bash-3.2$ cat echo.php
<? php
echo"heelo world"
>?
bash-3.2$ php echo.php
bash: php: command not found
actually I want to change certain thing a in a website using php script so I m beginner and trying... (6 Replies)
Discussion started by: manigrover
6 Replies
8. Shell Programming and Scripting
echo $result=exec("./permit.sh".$_FILES);
pls suggest some other method to run shell script in php .:wall::mad: (0 Replies)
Discussion started by: upvan111
0 Replies
9. Shell Programming and Scripting
Linux System having all Perl, Python, PHP (and Ruby) installed
From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file
eg
eg
a Shell script run in a case statement call to run a php file, also Perl or/and Python file???
Like
#!/usr/bin/bash
....
....
case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies
NWAUTH(1) nwauth NWAUTH(1)
NAME
nwauth - Verify username/password
SYNOPSIS
nwauth [ -h ] [ -S server ] [ -U user name ] [ -P password | -n ] [ -D ]
DESCRIPTION
nwauth does nothing but logging into a NetWare server. If the login was successful, an error code of 0 is returned. If the login was not
successful, an error code of 1 is returned. It was designed for use by other programs who want authenticate users via a NetWare server.
If there is no -P or -n option specified on command line, nwauth always expects a password on stdin. If the stdin is a tty, then the user
is prompted for a password. Otherwise nwauth simply reads stdin for a password.
nwauth looks up the file $HOME/.nwclient to find a file server and a user name if they are not specified on command line. See nwclient(5)
for more information. Please note that the access permissions of .nwclient MUST be 600, for security reasons.
OPTIONS
-h
-h is used to print a short help text.
-S server
server is the name of the server you want to use.
-U user name
If the user name your NetWare administrator gave to you differs from your unix user-id, you should use -U to tell the server about your
NetWare user name.
-D
nwauth says that your password is correct if you have existing connection to server with name user name. This is handy for some shell
scripts, but it is unacceptable for authorization modules, such as PAM, PHP or Apache. It was pointed to me that this behavior was not
well known, and there exist at least one PAM module which does not know that (this module is not part of ncpfs; you should use PAM mod-
ule which comes with ncpfs instead anyway).
SEE ALSO
nwclient(5)
CREDITS
nwauth was written by Volker Lendecke (lendecke@math.uni-goettingen.de)
nwauth 10/27/1996 NWAUTH(1)