By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,264 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,264 IT Pros & Developers. It's quick & easy.

pcntl_fork() and apache , redirect to stdout

P: n/a
I'm trying to run a system call('ls' in this simple case) that is taking
quite a long. I would like to fork the system call into a child process
and waits display the output of the call while it is running.

Here is a piece of code:

$pid = pcntl_fork();

for ($i = 1; $i <= 5; ++$i) {
$pid = pcntl_fork();

if (!$pid) {
$query = "ls /tmp";
system ($query,$ret_val);
print "In child $i\n";

How can i make this script dynamic in my web page. Meaning how can i
print each loop while the child process is running in Apache and
redirect to STDOUT in the webpage???
Jul 3 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.