Re: Execute appliction and pass parameters to it!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux