Running 2 scripts at the same time

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir
Forum Contributor
Posts: 287
Joined: Sat Oct 07, 2006 4:28 pm

Running 2 scripts at the same time

Post by amir »

Hello,

I have script (scriptA.php) that loops through lots of data and makes some operations on each loop. This takes some time to run, around 20-200 secs.

Also, i have another script (scriptB.php) that show statistics about the processes scriptA.php makes.

I run scriptA.php and scriptB.php in their own window. My problem is, scriptB.php does not print statistics results until scriptA.php finishes its processes.

How can I make scriptB.php work even scriptA.php didn't finish its processes?

TIA!
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

the pcntl_fork() function might be what you're looking for.. take a look in the manual here: http://www.php.net/manual/en/ref.pcntl.php

There are some good tutorials on the net for how to use this function

Cheers,
Kieran
Post Reply