Sponsored Content
Top Forums Shell Programming and Scripting Cannot run Shell script in PHP Post 302165488 by michrods on Friday 8th of February 2008 01:49:21 AM
Old 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

How to Run a shell script from Perl script in Parent shell?

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

Call shell script from php not run ?

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

Shell Script to Auto Run PHP Script

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

Help need to make a shell script run for ffmpeg vhook watermaking in shell

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

General Q: how to run/schedule a php script from cron jobs maybe via bash from shell?

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

Dry run php script from shell

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

Request to check run php in Unix shell

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

php file unable to run shell script with arguments

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

Shell script run in a case statement call to run a php file, also Perl

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
CPANPLUS::Shell(3pm)					 Perl Programmers Reference Guide				      CPANPLUS::Shell(3pm)

NAME
CPANPLUS::Shell - base class for CPANPLUS shells SYNOPSIS
use CPANPLUS::Shell; # load the shell indicated by your # config -- defaults to # CPANPLUS::Shell::Default use CPANPLUS::Shell qw[Classic] # load CPANPLUS::Shell::Classic; my $ui = CPANPLUS::Shell->new(); my $name = $ui->which; # Find out what shell you loaded $ui->shell; # run the ui shell DESCRIPTION
This module is the generic loading (and base class) for all "CPANPLUS" shells. Through this module you can load any installed "CPANPLUS" shell. Just about all the functionality is provided by the shell that you have loaded, and not by this class (which merely functions as a generic loading class), so please consult the documentation of your shell of choice. BUG REPORTS
Please report bugs or other issues to <bug-cpanplus@rt.cpan.org<gt>. AUTHOR
This module by Jos Boumans <kane@cpan.org>. COPYRIGHT
The CPAN++ interface (of which this module is a part of) is copyright (c) 2001 - 2007, Jos Boumans <kane@cpan.org>. All rights reserved. This library is free software; you may redistribute and/or modify it under the same terms as Perl itself. SEE ALSO
CPANPLUS::Shell::Default, CPANPLUS::Shell::Classic, cpanp perl v5.16.2 2012-10-11 CPANPLUS::Shell(3pm)
All times are GMT -4. The time now is 01:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy