Hi,

thank you very much for help. I will try this solution.
Do you believe there is still a way to use the exec() function of PHP ?

regards,
markus weber


"J Wynia" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Mwct - Markus Weber wrote:
> > Hi,
> >
> > may be someone can help me:
> >
> > I want to use the exec() function to run an executable as background
> > process. This means my php script should not wait for the end of the
> > background process. I tried a lot but without success. My script always
wait
> > for the end of the background process.
> >
> > My php script contains this line:
> >
> > exec(getenv("COMSPEC").' /c c:\mysql\bin\mysql.exe <
> > E:/Inetpub/wwwroot/update/load_logs.sql >
> > E:/Inetpub/wwwroot/update/load_logs.log');
> >
> > Regarding to the online documentation on php.net all screen output is
> > redirected to the file "load_logs.log".
> >
> > When I type in this string via command line the execution is successful.
> >
> > As I learned from the online documentation on php.net is that on LINUX
> > systems something like "2>1&" or ">/dev/null" will help - but not on
> > Windows.
> >
> > Any ideas ?
>
> If this script will only ever be run on Windows servers, you can use the
> Windows-specific shell capabilities through the COM interface.
>
> $shell = new COM("WScript.Shell") or die("This thing requires Windows
> Scripting Host");
> $shell -> Run($commandinquotes,$windowstate,$wait);
>
> Replace $commandinquotes with your commandline that you want to run. Put
> it in single quotes. Replace $windowstate with 1, 2 or 3 for normal DOS
> window, minimized or maximized and $wait with 0 in your case because you
> don't want PHP to wait for the process to finish.
>
> You could abstract it further by turning the COM "Run" into your own
> function. The below code hasn't been tested.
>
> function win_exec($command, $windowstate, $wait) {
> $shell = new COM("WScript.Shell") or die("This thing requires Windows
> Scripting Host");
> $shell -> Run($commandinquotes,$windowstate,$wait);
> }
>
> $command = getenv("COMSPEC").' /c c:\mysql\bin\mysql.exe <
>  > E:/Inetpub/wwwroot/update/load_logs.sql >
>  > E:/Inetpub/wwwroot/update/load_logs.log';
>
> win_exec($command, "2", "0");
>



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

Reply via email to