473,395 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Forking PHP on Windows 2003.

We are attempting to fork a php script into a background php script and
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.

Jul 17 '05 #1
4 2160
nc
Hopeless A wrote:

We are attempting to fork a php script into a background
php script and have the first scrip continue to completion.
Is this even possible in the windows version of php?
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 ' .
'C:\inetpub\wwwroot\background.php');

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
complete...
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.


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
/CLI subfolder)...

Cheers,
NC

Jul 17 '05 #2
"Hopeless A" <ho**************@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
We are attempting to fork a php script into a background php script and
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.


Try the AT command.
Jul 17 '05 #3
Some progress but now i'm getting:

Warning: exec() [function.exec]: Unable to fork [start cmd /E:OFF /C
.........

Jul 17 '05 #4
NC / Chung,

Thanks for the assist. What was causing the error was the script must
run as a user that has the ability to interact with the OS.

Hopeless A

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Eric S. Johansson | last post by:
I was working on a filter for postfix and instead of using the "fork a new python process on every message" route, I decided to use the SMTP interface instead and try forking after having started...
1
by: SRam | last post by:
How to create a threaded process in Perl. I need explanation for this code from Advanced Perl Programming.... # Forking server use IO::Socket; $SIG{CHLD} = sub {wait ()}; $main_sock = new...
0
by: SRam | last post by:
I a writing Forking Server for a Small application.. This is code for multiplexing my $listen = IO::Socket::INET->new(Proto => 'tcp',LocalPort => 2323, Listen => 1, Reuse => 1) or die $!; ...
3
by: felixfix | last post by:
Hi all, I am just wondering if something is wrong with my program. What it bascially does is to output a fibonacci sequence base on the command-line output. If I give a 5, it will generate the...
5
by: JDS | last post by:
Hi. I have installed the PCNTL functions on my PHP enabled webserver in the interest of being able to fork a process into the background so I can do some heavy processing but return control of the...
9
by: Andrew Robert | last post by:
Hi everyone, I have a python program that will need to interact with an MQSeries trigger monitor. It does this fine but it hogs the trigger monitor while it executes. I'd like to fork the...
3
by: czajnik | last post by:
Hi! I'm quite new to Python development. Can someone advise me a framework useful for building (pre-)forking or threaded TCP servers, other than SocketServer ? I've seen source code of a few...
10
by: qwertycat | last post by:
I'm new to multi-process programming, should one avoid forking children from children of a parent? I'd like to spawn 10 children from the parent and each of those children spawns another 5...
2
by: Gilles Ganault | last post by:
Hello I'd like to rewrite the following Perl script in Python: http://www.voip-info.org/wiki/view/Asterisk+NetCID It seems like the following doesn't actually fork, so Asterisk is stuck...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.