ID:               30794
 User updated by:  stolle at web dot de
 Reported By:      stolle at web dot de
 Status:           Bogus
 Bug Type:         Program Execution
 Operating System: Windows XP SP2
 PHP Version:      5.0.2
 New Comment:

It seems to be so, that PHP wait's for the last process of the group of
child processes to terminate.
Is there any way (in PHP) to break that behavour?


Previous Comments:
------------------------------------------------------------------------

[2004-11-15 21:36:41] stolle at web dot de

you have to make sure that the
output of that program is redirected to a file or some other output
stream or else PHP will hang until the execution of the program ends."

So the right question may be: How do i redirect the standardoutput
under Windows, so that PHP do NOT wait fpr the end of the Programm.

I tried som more lines:
    exec( "cmd.exe /c start c:/windows/notepad.exe <nul: 2>nul: >nul:"
);

    exec( "c:/windows/notepad.exe <nul: 2>nul: >nul:" );

It's always the same: PHP always wait's for notepad's end. BUT I DONT
WANT TO WAIT! 
What do i have to do (under windows) to not wait for the end of the
program ???

------------------------------------------------------------------------

[2004-11-15 16:54:22] [EMAIL PROTECTED]

I don't see any bugs here. It's pretty well expected behaviour.
The docs say: "If you start a program using this function and want to
leave it running in the background, you have to make sure that the
output of that program is redirected to a file or some other output
stream or else PHP will hang until the execution of the program ends."
But your program *waits for your input* (i.e. until you close it), so
PHP will wait for it too, 'cause exec() "returns the last line from the
result of the command" (c).

------------------------------------------------------------------------

[2004-11-15 14:47:22] stolle at web dot de

Description:
------------
I'm using PHP on Apache2 (both: Latest Builds)

When starting a Program using "exec()" die PHP-Scripts allways hangs
under Windows, until the started program terminates.

There is no chance to start f.e. notepad.exe in that way, that notepad
runs interaktivly, but PHP continous work.

Notepad is just an example, i want to control (start and stop) some
Windows-Tasks throug PHP.

I tried the latest PHP snapshot-Version as well.

Reproduce code:
---------------
    exec('notepad.exe');

    exec( "cmd.exe /c c:/windows/notepad.exe 2>nul: >nul:" );


    exec( "c:/windows/notepad.exe 2>nul: >nul: &" );

    exec( "c:/windows/notepad.exe 2>nul: >nul:" );


Expected result:
----------------
PHP Script should NOT wait for end of notepad

Actual result:
--------------
PHP Script wait's for end of notepad


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30794&edit=1

Reply via email to