Re: Execute appliction and pass parameters to it!
| From: | Richard Lynch | Date: | Tue, 29 Mar 2005 21:17:35 +0000 |
| Subject: | Re: Execute appliction and pass parameters to it! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-211812@lists.php.net to get a copy of this message | ||
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