Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Forking PHP on Windows 2003.
- Hopeless A
January 14, 2005, 3:42 pm
rate this thread
have the first scrip continue to completion. Is this even possible in
the windows version of php? We have used the many code snippets
floating around on the Internet claiming to fork on Windows, yet we
never get it to work properly, sometimes ending up with hunderds of
dead php.exe processes on the machine.
Our environment is:
Windows 2k3 server
PHP 4.3.6 (cgi-fcgi) (built: Apr 14 2004 17:21:37)
If there is any other info needed to determine the problem I'll gladly
reply with it.
All assistance is appreciated.
Re: Forking PHP on Windows 2003.
Yes, if Windows itself allows it. You probably tried something
along the lines of:
exec('start C:\php\cli\php.exe C:\inetpub\wwwroot\background.php');
However, if you type HELP START from your Windows command prompt,
you may notice this bit:
If Command Extensions are enabled, external command
invocation through the command line or the START command
changes as follows:
When executing an application that is a 32-bit GUI
application, CMD.EXE does not wait for the application
to terminate before returning to the command prompt.
This new behavior does NOT occur if executing within
a command script.
My guess is that you have Command Extensions enabled, so
forking doesn't work. Try this:
exec('start cmd /E:OFF /C C:\php\cli\php.exe ' .
The /E:OFF switch will disable Command Extensions for the
duration of this command-line session, while the /C switch
will make sure the session will terminate after it's
Are you sure you are using the correct php.exe? Rememeber,
there are two files named php.exe in PHP distribution,
the CGI executable (usually located in PHP root folder)
and the command-line interpreter (usually located in the