Re: Parsing commands to a program

From: Date: Sat, 02 Feb 2002 16:20:04 +0000
Subject: Re: Parsing commands to a program
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-83241@lists.php.net to get a copy of this message
How I've done it in the past is to dynamically build the command string and then pass it through the exec function like so: $cmdStr = "pure-pw useradd joeblow -u ftpuser -d /home/joeblow"; exec($cmdStr); The exec call won't display output but I believe if you use system($cmdStr) it will. I don't think this method will work if the useradd program prompts for a password. The exec and system calls just execute the command and exit. Jason ----- Original Message ----- From: "Liam MacKenzie" <phplist@operationenigma.com> To: <php-general@lists.php.net> Sent: Saturday, February 02, 2002 5:54 AM Subject: Re: [PHP] Parsing commands to a program > Nope, can't get that to work. > Any more suggestions? > > ----- Original Message ----- > From: "val petruchek" <petruchek@zsu.zp.ua> > To: "PHP" <php-general@lists.php.net> > Sent: Saturday, February 02, 2002 8:58 PM > Subject: Re: [PHP] Parsing commands to a program > > > > > Hello, > > > > > > I was wondering, how would I pass commands to a program and print the > > > results on my screen? > > > For instance, to add an FTP user the command would be: > > > "pure-pw useradd joeblow -u ftpuser -d /home/joeblow" > > > How would I make a php script do that and display it's output when it's > > > done? > > > > > > > > > Try > > <?php > > echo pure-pw useradd joeblow -u ftpuser -d /home/joeblow; > > //not quotes > by > > ticks! > > ?> > > > > but not sure about security allows u to do it > > > > Valentin Petruchek (aki Zliy Pes) > > Cut the beginning > > http://zliypes.com.ua > > mailto:val@zliypes.com.ua > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.general (#83241) next »