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 Bryan Oakley on 12/01/06 17:48

comp.lang.tcl wrote:
> Bryan Oakley wrote:
>
>>comp.lang.tcl wrote:
>>
>>>[TCL]
>>>
>>>set php {<? print_r("Hello World"); ?>}
>>>...
>>>[/TCL]

>>If you're wanting to exec php and give it the contents of a variable on
>>stdin, try this:
>>
>>puts [exec php << $php]
>>
>>You need to make sure that "php" is a valid command file on your
>>machine, and that its location is in your PATH environment variable.
>
>
> Ok this is what I did:
>
> [TCL]
> set contentsList [exec $valPHPPath << $php]; # $valPHPPath IS THE PATH
> TO "php"
> [/TCL]
>

In the above, is $php the string you showed earlier or does it contain
something else?

> And here is the error message I now 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 << $php" (procedure "XML_GET_ALL_ELEMENT_ATTRS" line 36)
>

I'm not sure what the problem is, if all you say is true. When I type in
the equivalent, I get back "Hello World":

$ tclsh
% set php {<? print_r("Hello World"); ?>}
<? print_r("Hello World"); ?>
% exec php << $php
Hello World

So... the only conclusion I can draw is that your php command doesn't
work the same way as mine. That, or you're putting something different
in $php. Unfortunately I am not able to exactly duplicate your
environment since you're executing tcl from with a web page served by
some tcl-enabled web server, and I don't have that web server (what web
server is that, BTW?)

The only thing I can suggest at this point is that the problem is no
longer a Tcl problem but rather a php or web server problem.

Is it possible that your php script prints to stderr instead of / in
addition to stdout? If exec detects output on stderr it will throw an
error unless stderr is redirected (this is all documented on the exec
man page)


> I even tried a variant:
>
> [TCL]
> set contentsList [exec $valPHPPath << '[regsub -all {'} $php {\\'} php;
> set php]']
> [/TCL]
>

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.

 

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

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