Reply to Re: 'echo "": No such file or directory" error using "exec" to pipe in PHP script

Your name:

Reply:


Posted by Bryan Oakley on 12/01/06 18:26

comp.lang.tcl wrote:
> When I went into command-line and tried it (again I'm using HP-UX
> apparently):
>
> [quote]
> set php
> <?
> error_reporting(E_ALL & ~E_NOTICE);
> ...

You are obviously paraphrasing; the above is invalid tcl and can't
possibly be what you are actually doing or you would get different
error messages. When you are reporting results, please try to be exact.
Show us *precisely* what you type.


> $xml = preg_replace('/(>)[\\n\\r\\\s\\t]+(<)/', '$1$2',
> $argv[1]); /* STRIP OUT WHITESPACE xml_parser_set_option() MIGHT MANGLE
> XML */
> $parser = @xml_parser_create();
> @xml_parse_into_struct($parser, $xml, $xmlArray, $tags);
> @xml_parser_free_parser($parser);
> for ($i = 1; $i < @sizeof($xmlArray) - 1; $i++) \{
> foreach ($xmlArray[$i]['attributes'] as $attr => $val)
> $tclList .= $attr . ' \{' . str_replace('\{', '&#123;',
> str_replace('\}', '&#125;', $val)) . '\} '; /* ESCAPED CURLY BRACES FOR
> TCL LIST */
> \}
> echo trim($tclList);
> ?>
> % exec /usr/local/bin/php -q << $php
> <br />
> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1
> in <b>-</b> on line <b>7</b><br />
> <br />
> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1
> in <b>-</b> on line <b>10</b><br />
> child process exited abnormally
>
> [/quote]
>
> I realize I am getting PHP errors, so at this point I don't know if
> this is a TCL problem with the way I'm creating $php, or a PHP problem
> with the way TCL handles PHP.

What happens if you cut and paste that exact data into a file and
execute it via php? And by "exact" I mean *exact*, minus the leading and
trailing {} (assuming you're using {} when assigning the php script to
the php variable).

>>
>>Are you aware that single quotes are not a valid quoting mechanism for
>>Tcl? Any time you try to use single quotes to quote something in Tcl
>>you're bound to be disappointed.
>
>
> Yes, but I was assuming that I needed to encase $php in single quotes
> not for TCL exec but for the shell statement that is served by TCL
> exec, if that makes sense.

Tcl's exec doesn't have anything to do with a "shell statement". In the
way you are using it you aren't executing a shell, not even magically
under the covers. You're executing php directly. It is important you are
aware of that fact.

[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

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