You are here: Re: 'echo "": No such file or directory" error using "exec" to pipe in PHP script « All PHP « IT news, forums, messages
Re: 'echo "": No such file or directory" error using "exec" to pipe in PHP script

Posted by comp.lang.tcl on 12/01/06 20:38

Bryan Oakley wrote:
> 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.

set php {<?
error_reporting(E_ALL & ~E_NOTICE);
$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);
?>}

global valPHPPath
if {![info exists valPHPPath]} {
if {![array exists env]} { global env }
source cgi_globals.tcl
global valPHPPath
}
set contentsList [exec $valPHPPath << $php]


-----------
There you go, exactly what I typed
-----------

This is the error I get:

Status: 404 X-Powered-By: PHP/4.4.4 Content-type: text/html No input
file specified. child process exited abnormally while executing "exec
$valPHPPath -q << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 37)



>
>
> > $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).

I get warnings on the lines where I have "\{" and "\}", but don't I
have to escape curly braces found within strings encased in curly
braces?

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

I think I understand.. that's as far as I can go right now

 

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

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