By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,656 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

system commands

P: n/a
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");

?>
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
yawnmoth <te*******@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?
?>


Is safe mode enabled? If so, is there an ls and a cat program in the
safe_mode_exec_dir?

--
Chris
Jul 16 '05 #2

P: n/a
On 13 Aug 2003 10:16:56 +0100, Chris Morris <c.********@durham.ac.uk>
wrote:
yawnmoth <te*******@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?


hehe - that was the problem :)

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...
Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.