Reply to Re: [PHP] Execute appliction and pass parameters to it!

Your name:

Reply:


Posted by Richard Lynch on 03/30/05 00:17

On Tue, March 29, 2005 10:38 am, Dipesh Khakhkhar said:
> ------------------------------------------------------------------
>
> 1) $output = shell_exec('..\phpunit.bat C:\Run.php');
> echo $output;

Change shell_exec to exec, and use the extra parameters to get back ERROR
MESSAGES and ERROR CODE.

Print those out, and Windoze should tell you what's wrong.

Don't use '..\phpunit.bat' -- Use a full pathname.

Also don't use \ at all, I don't think... I *think* PHP will convert / to
the right thing for your OS. No promises on that part.

If you *DO* use \, you should use \\, even inside '', just case your
filename ever has a ' in it or you ever need to use variables, switch to
"", and suddenly it "doesn't work" because now \n isn't what it once was.

> 3) $firstArg = "C:\\..\\..\\Run.php";
> $output = exec("C:\\..\\..\\phpunit.bat $firstArg");
>
> Result: Still nothing is happening.
>
> 4)$output = exec("C:\\..\\..\\phpunit.bat $firstArg 2>&1", $myOut);
> echo "<br/>My out value is ".$myOut;
> Result: My out value is Array operable program or batch file.

echo "<br />My out value is ", implode("", $myOut);

Also add $myError argument, and do:
if ($myError) echo "OS Error: $myError<br />\n";


--
Like Music?
http://l-i-e.com/artists.htm

[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

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