[PHP] proc_open problems
Hello, I am using php 4.3.0, and am trying to launch the command line interface for cisco network registrar, and be able to send commands to it and read the output from those commands. Problem I am having is that the commands can take some time to actually respond with output. I can make it work by putting in a sleep after the write/before the read, but i'd like to not have to do that. I have pasted some sample code below (which is basically made up of sample's from the proc_open samples on the php site). Any suggestions would be appreciated. $dspec = array ( 0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("file", "/tmp/ErrorLog.txt", "a"), ); $process = proc_open("$cli", $dspec, $pipes); if (is_resource($process)) { fwrite($pipes[0], $str."\n"); stream_set_blocking($pipes[1], FALSE); while ($ret = fgets($pipes[1], 1024)) { print $ret . "\n"; } } fclose($pipes[0]); fclose($pipes[1]); $return_value=proc_close($process); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Proc_open() problems
Just found it: http://expect.nist.gov/ Piero B. Contezini wrote: Do you have any idea where I can find more info about it? Piero -Mensagem original- De: Marek Kilimajer [mailto:[EMAIL PROTECTED] Enviada em: quarta-feira, 19 de março de 2003 12:02 Para: Piero B. Contezini Cc: [EMAIL PROTECTED] Assunto: Re: [PHP] Proc_open() problems The problem is that ssh (and various others, like passwd) command does not use the standard input/output functions, but there is a workaround program for this, but I don't remember its name. Piero B. Contezini wrote: I'm having problems while opening a ssh session thru proc_open(), anyone knows why i can see the remote terminal prompt while reading the stdout? It just doesn't appear! Piero "It occurred to me by intuition, and music was the driving force behind that intuition. My discovery was the result of musical perception". Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: RES: [PHP] Proc_open() problems
search freshmeat.net Piero B. Contezini wrote: Do you have any idea where I can find more info about it? Piero -Mensagem original- De: Marek Kilimajer [mailto:[EMAIL PROTECTED] Enviada em: quarta-feira, 19 de março de 2003 12:02 Para: Piero B. Contezini Cc: [EMAIL PROTECTED] Assunto: Re: [PHP] Proc_open() problems The problem is that ssh (and various others, like passwd) command does not use the standard input/output functions, but there is a workaround program for this, but I don't remember its name. Piero B. Contezini wrote: I'm having problems while opening a ssh session thru proc_open(), anyone knows why i can see the remote terminal prompt while reading the stdout? It just doesn't appear! Piero "It occurred to me by intuition, and music was the driving force behind that intuition. My discovery was the result of musical perception". Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RES: [PHP] Proc_open() problems
Do you have any idea where I can find more info about it? Piero -Mensagem original- De: Marek Kilimajer [mailto:[EMAIL PROTECTED] Enviada em: quarta-feira, 19 de março de 2003 12:02 Para: Piero B. Contezini Cc: [EMAIL PROTECTED] Assunto: Re: [PHP] Proc_open() problems The problem is that ssh (and various others, like passwd) command does not use the standard input/output functions, but there is a workaround program for this, but I don't remember its name. Piero B. Contezini wrote: >I'm having problems while opening a ssh session thru proc_open(), >anyone knows why i can see the remote terminal prompt while reading the >stdout? It just doesn't appear! > > >Piero > >"It occurred to me by intuition, and music was the driving force behind >that intuition. My discovery was the result of musical perception". >Albert Einstein > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Proc_open() problems
The problem is that ssh (and various others, like passwd) command does not use the standard input/output functions, but there is a workaround program for this, but I don't remember its name. Piero B. Contezini wrote: I'm having problems while opening a ssh session thru proc_open(), anyone knows why i can see the remote terminal prompt while reading the stdout? It just doesn't appear! Piero "It occurred to me by intuition, and music was the driving force behind that intuition. My discovery was the result of musical perception". Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Proc_open() problems
I'm having problems while opening a ssh session thru proc_open(), anyone knows why i can see the remote terminal prompt while reading the stdout? It just doesn't appear! Piero "It occurred to me by intuition, and music was the driving force behind that intuition. My discovery was the result of musical perception". Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] proc_open() problems
I've written a script that uses proc_open() to call and external program and capture it's output. My script works fine as long as I call/use it in the directory where it resides. But if I try to include() it in a script that resides in another folder proc_open() return an exit value of 255. I can't access the external program. What am I missing? Some file perms? I did a "chown -R apache *" from the top directory but that didn't help ... I'm using the php.ini-recommended file. Is there some setting in there I should change? Jc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php