473,396 Members | 2,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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");

?>
Jul 16 '05 #1
2 4876
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Siemel Naran | last post by:
Hi. I'm writing a command shell that reads commands from standard input. At this point I have the command in a std::string. Now I want to execute this command in the shell. From the Borland...
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
1
by: ktsirig | last post by:
Hi all! I want to execute system commands through the functions provided by PHP (like exec, system etc) In the LINUX machine in my work, everything seems to be OK, when, for example, I write...
14
by: jas | last post by:
I would like to redirect the output from os.system to a variable, but am having trouble. I tried using os.popen(..).read() ...but that doesn't give me exactly what i want. ...this is windows by...
2
by: Raquel | last post by:
Why can we not give db2 System commands (commands starting with 'db2' like db2ilist, db2look, db2move etc.) through the Command Center? It is so convenient to retrieve and change commands in the...
1
by: darren kirby | last post by:
Hello all. I have a python script here which is just a wrapper for 2 or more system commands. I would estimate the program spends at least 95.5% of 'real' time running the system commands. ...
1
by: Brad | last post by:
I have an issue trying to execute commands in a web service. The command starts under the specified user. However, it never completes its execution. I can execute simple commands like "echo HELLO"...
8
by: AG | last post by:
Hello, This is my first post to this group, and on top of that I am a beginner. So please direct me to another group if this post seems out of place.... I have recently written a program which...
12
by: Bob | last post by:
Howdy, Why does a call to system() work by passing the command line string supplied to sh -c? This is causing problems when running in a chroot environment where no sh is available. Wouldn't it...
20
by: Kevin Walzer | last post by:
>>import os kevin 0 The standard output of the system command 'whoami' is my login name. Yet the value of the 'foo' object is '0,' not 'kevin.' How can I get the value of 'kevin' associated...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.