[PHP-WIN] exec() without waiting for completion in Win2k

2002-09-08 Thread Noel Llopis

Hello,

I'm working on a web front-end for our build system. One of the 
things I need to do is allow the user to start a lengthy build in the
back and continue using the web page.

Unfortunately, I can't find out how to do it. I can start the
build, but the web page won't complete loadinguntil the build 
finishes (which considering it can take up to 5 hours, it's 
not a good thing ;-)

I'm using Apache 1.3 under Win2k and PHP 4.2.3. I tried all 
combinations of exec ("cmd /c start build"), even doing
exec ("cmd /c start build.bat"), where build.bat contains
start build. Nothing. The web page always waits for the command
to finish.

I'm running PHP as an Apache module. I tried running it as
CGI but had no luck getting PHP to work at all.

Any suggestions? It's the most important thing this front 
end has to do. Without it, there would be no point to the program
in the first place.

Switching to Linux, unfortunately, is not an alternative I can 
consider right now since the build itself needs to happen 
in Win2k.

Thanks.


--Noel
[EMAIL PROTECTED]


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




Re: [PHP-WIN] Re: exec() without waiting for completion in Win2k

2002-09-08 Thread Noel Llopis


On Sun, 08 Sep 2002 15:32:31 -0700
Kurtis Harper <[EMAIL PROTECTED]> wrote:

> I am having problems as well with exec() but this may help in your
> case, try single quotes, eg add this to your php script: exec ('start
> C:\path\to\your\bat\file\build.bat');

I'm afraid it didn't. Still the same problem. The page just waits for
the process to end.

On Sun, 08 Sep 2002 20:56:28 -0700
Rich Gray <[EMAIL PROTECTED]> wrote:

> What does this do?
> 
> exec(getenv('COMSPEC').' /c c:\path\to\your\bat\file\build.bat >NUL');
> 
> Do you see any errors in the log file?

No luck with that either. COMSPEC is defined as D:\WINNT\system32\cmd.exe ,
which is what I would expect.


Here's a simplified version. How about starting notepad from PHP? Can
anybody do that and have the web page finish generating before Notepad
is closed? It helps to try it out with the console version of Apache,
that way you can close Notepad by hand (instead of having to kill it
from the process list).

If anybody can get that to work, let me know. I would change my
configuration to match yours. 

Thanks for all the suggestions so far.


--Noel
[EMAIL PROTECTED]


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




Re: [PHP-WIN] Re: exec() without waiting for completion in Win2k

2002-09-08 Thread Noel Llopis


On Sun, 08 Sep 2002 22:42:44 -0700
Rich Gray <[EMAIL PROTECTED]> wrote:

> Sorry ... I misunderstood (i.e. didn't bother to read your post fully!) -
> look into running the AT command to run the command asyncronously
> 
> i.e.
>  $time=date("H:i");
> exec(getenv('WINDIR').'\\system32\\at.exe '.$time.'
> C:\MyPath\MyScript.bat');
> ?>

Hmmm... Tempting, but there is one big problem. I just found out that
commands executed with AT don't have access to network drives or
settings. Some of this build process involves fetching data over the
network, so it won't work.

I even wrote a C program that calls spawn() on the command you pass on
the command line, but it didn't work either. I can't believe how
frustrating this is. All of which could have been accomplished with a
sinmple & under Unix :-(

Any other ideas? I think I tried just about everything I could think of.
Thanks.


--Noel

> -Original Message-
> From: Noel Llopis [mailto:[EMAIL PROTECTED]]
> Sent: 08 September 2002 13:43
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] Re: exec() without waiting for completion in
> Win2k
> 
> 
> 
> On Sun, 08 Sep 2002 15:32:31 -0700
> Kurtis Harper <[EMAIL PROTECTED]> wrote:
> 
> > I am having problems as well with exec() but this may help in your
> > case, try single quotes, eg add this to your php script: exec ('start
> > C:\path\to\your\bat\file\build.bat');
> 
> I'm afraid it didn't. Still the same problem. The page just waits for
> the process to end.
> 
> On Sun, 08 Sep 2002 20:56:28 -0700
> Rich Gray <[EMAIL PROTECTED]> wrote:
> 
> > What does this do?
> >
> > exec(getenv('COMSPEC').' /c c:\path\to\your\bat\file\build.bat >NUL');
> >
> > Do you see any errors in the log file?
> 
> No luck with that either. COMSPEC is defined as D:\WINNT\system32\cmd.exe ,
> which is what I would expect.
> 
> 
> Here's a simplified version. How about starting notepad from PHP? Can
> anybody do that and have the web page finish generating before Notepad
> is closed? It helps to try it out with the console version of Apache,
> that way you can close Notepad by hand (instead of having to kill it
> from the process list).
> 
> If anybody can get that to work, let me know. I would change my
> configuration to match yours.
> 
> Thanks for all the suggestions so far.
> 
> 
> --Noel
> [EMAIL PROTECTED]
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


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