Ask a Question related to PHP Development, Design and Development.
-
yawnmoth #1
system commands
i know that system commands can be run using the system("command")
function, but... some commands, such as mysqldump, require additional
input - input that can't be entered through the command line...
(atleast i don't think the password can be entered through the command
line with mysqldump - i could be wrong...)
also, is there a way i could have internet explorer, or whatever
browser, download the output (as opposed to viewing it)?
thanks in advance :)
yawnmoth Guest
-
File system commands
Hi, I've been trying to work out how to issue file system commands from a PHP script to Redhat Linux. I want to be able to delete files and... -
piped system commands
deb wrote: Try changing the $2 to \$2. Perl is interpolating $2 before it gets to bash, so bash sees "/bin/awk '{print }'". -- Andrew Gaffney... -
perl interactive system commands
rhlinux wrote: I've tried just about every method you can think of to get this to work correctly. Unfortunately, passwd is coded to only accept... -
Running system commands
Hi all, I was wondering, if anyone can help me with running system commands from within php. Actually I have a script which deletes users from my... -
System() works on /usr/sbin commands
hello, i was using system function to invoke useradd command but it doesn't work. well it works for all the commands but not those in /usr/sbin.... -
Senator Jay Billington Bulworth #2
Re: system commands
In article <0k99jvomk7vuucudkjc1pmh7tkt131j5qm@4ax.com>,
yawnmoth <terra1024@yahoo.com> wrote:
Before sending any output, issue this header:> also, is there a way i could have internet explorer, or whatever
> browser, download the output (as opposed to viewing it)?
header('Content-type: application/octet-stream');
Most browsers will download the file as it's named on the server,
perhaps prompting the user first to make sure they want to download it.
If you want to set a different name, send this header as well:
header('Content-disposition: inline; filename="foobar.txt"');
hth
--
Bulworth : [email]funha@fung.arg[/email] | My email address is ROT13 encoded, decode to mail
--------------------------|--------------------------------------------------
<http://www.phplabs.com/> | PHP scripts and thousands of webmaster resources!
Senator Jay Billington Bulworth Guest
-
yawnmoth #3
system commands
i'm running the following php script, and where i would expect it to
create a file, test.txt, it doesn't. it isn't in the directory i am
exectuting the script in, nor can i do cat on it (not that i would
expect to, since it doesn't exist, heh):
<?php
print system("ls > test.txt");
print system("cat ls.txt");
?>
yawnmoth Guest
-
Chris Morris #4
Re: system commands
yawnmoth <terra1024@yahoo.com> writes:
cat test.txt, surely?> i'm running the following php script, and where i would expect it to
> create a file, test.txt, it doesn't. it isn't in the directory i am
> exectuting the script in, nor can i do cat on it (not that i would
> expect to, since it doesn't exist, heh):
>
> <?php
>
> print system("ls > test.txt");
>
> print system("cat ls.txt");
Is safe mode enabled? If so, is there an ls and a cat program in the> ?>
safe_mode_exec_dir?
--
Chris
Chris Morris Guest
-
yawnmoth #5
Re: system commands
On 13 Aug 2003 10:16:56 +0100, Chris Morris <c.i.morris@durham.ac.uk>
wrote:
hehe - that was the problem :)>yawnmoth <terra1024@yahoo.com> writes:>>> i'm running the following php script, and where i would expect it to
>> create a file, test.txt, it doesn't. it isn't in the directory i am
>> exectuting the script in, nor can i do cat on it (not that i would
>> expect to, since it doesn't exist, heh):
>>
>> <?php
>>
>> print system("ls > test.txt");
>>
>> print system("cat ls.txt");
>cat test.txt, surely?
however, that doesn't help me solve the problem i was hoping it would
solve :(
if that works, then why doesn't this work?:
<?php
system("mysqldump --opt -u $dbuser --password=$dbpasswd $dbname |
gzip > $dbname" . ".gz");
print "<a href=\"$dbname" . ".gz\">Download backup</a>";
?>
ls > test.txt outputted to the directory the php script was in (as i
would expect it to), so why doesn't that? i can't find that file
anywhere, and when i run the mysqldump command through the command
line, it works just fine...
yawnmoth Guest



Reply With Quote

