Reply to Re: How do you do TCL exec command on PHP script that uses user input?

Your name:

Reply:


Posted by Ralf Fassel on 11/18/05 22:05

* "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.

| 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}

# 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'

[Back to original 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

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