You are here: Re: How do you do TCL exec command on PHP script that uses user input? « PHP Programming Language « IT news, forums, messages
Re: How do you do TCL exec command on PHP script that uses user input?

Posted by comp.lang.tcl on 11/19/05 00:26

Please see below, thanx

Ralf Fassel wrote:
> * "comp.lang.tcl" <phillip.s.powell@gmail.com>
> | set cannotRunPHP [catch {
> | eval "exec php -q $root/scripts/info/php/info.php"
> | } errMsg]
>
> Get rid of that 'eval' there,
> set cannotRunPHP [catch {
> exec php -q $root/scripts/info/php/info.php
> } errMsg]
> is enough and avoids problems with double-eval of $root.
>

For some reason that I never understood, leaving off "eval" on TCL exec
commands insured that the file included within eval "exec php -q
[myfile]" would never be run unless I added eval. No explanation at
all.

> | I have to do it this way as both the TCL script and the PHP script
> | run as CLI. However, "info.php" requires user input to run; this
> | causes the TCL script calling the PHP script to hose up and die.
>
> Usually, if you exec, TCLs stdin becomes the stdin for the exec'd
> process, so there is no immediate reason why the PHP script should
> terminate.
>
> If you have the input available inside TCL, you can redirect the stdin
> of the exec'd command like this:
>
> # get PHP input from some source
> set php_input {some stuff}
>

That would not work here that I understood. You are entering the data
yourself. The PHP script will prompt you to enter something:

Enter your username: [here is where you enter something in the command
line]
Etc.

> # redirect stdin for PHP via <<
> set cannotRunPHP [catch {
> exec php -q $root/scripts/info/php/info.php << $php_input
> } errMsg]
>
> Now the PHP process will see the contents of the TCL php_input
> variable on stdin. Check the TCL 'exec' manpage for more details on
> input redirection.
>
> HTH
> R'

Maybe if you clarified it a bit more I would know how to implement, as
it is, I'm just as confused as before, I'm afraid and I'm sorry.

Phil

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация