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

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

* "comp.lang.tcl" <phillip.s.powell@gmail.com>
| If I am interpreting correctly, you want the PHP script to write to
| stderr the specific error message if the user inputs "nothing" (i.e.,
| just hits the carriage return).

The best thing would be a non-zero exit status of the PHP script in
this case. The second best thing would be a message to stderr.

| [TCL]
| if {[catch {exec php -q $root/scripts/php/info.php >@stdout} errMsg]} {
| writeErr "Could not run PHP Script: $errMsg"
| }
| [/TCL]

This 'catch' will trigger if:
- the PHP script exits with nonzero status
% catch {exec false}
1
% set ::errorCode
CHILDSTATUS 23911 1

- the PHP script writes anything to stderr:
% catch {exec sh -c {echo foo >&2}}
1
% set ::errorCode
NONE

You distinguish the two cases by looking at errorCode, it is NONE in
the case of normal exit (status 0) but some output on stderr.

| [PHP]
| if (is_resource(STDERR)) @fputs(STDERR, $errMsg);
| [/PHP]

Well, obviously this will not work as intended if
'is_resource(STDERR)' is false.

R'

 

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

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