You could just log the IP into a database, and then look it up later in
another script in a "cron" job.  You'll need PHP installed as a stand-alone
binary (aka CGI) and you'll want to read:

man 5 crontab

You could use select distinct and then would only need to look up each IP
once for a user that viewed many pages.

If you wait too long, though, the IPs will change on you for DHCP clients.
Still the same country probably though.

To answer your original question :-) what you are talking about is called
"fork" (like a fork in the road) and you do it something not unlike this:

exec("/path/to/some/other/script &", $results, $errorcode);
echo implode("<BR>\n", $results);
if ($errorcode){
    echo "OS Error: $errorcode.  Usually path/permissions.  man
errno<BR>\n";
}

It's the & symbol that tells the shell to fork.

The other script in question has to, errrr, I forget exactly, but I think it
has to *NOT* bind up stdin, stdout, or stderr, because then Apache and PHP
are waiting for that output...

Search the archives for "fork" and "&" and "exec" and you should find more
posts.

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm
----- Original Message -----
From: Jordan Pickup <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Monday, August 27, 2001 4:03 PM
Subject: A Separate Process?


> Is there any way to make a separate process in PHP?
>
> I do real-time stats collection on my site and one of the things I collect
> is the domain of the user (to get their country).
>
> Sometimes getting the domain name takes a few seconds to come back and the
> user has to wait for that time before their page displays.
>
> Is there any way to split of a separate process - that doesn't end when
the
> current process ends - to do the stats collecting so that the user doesn't
> have to wait?
>
> Or, if not, is there some way to tell the browser that it has all the data
> (so that it will finish rendering the page and run my javascript) and the
> script can continue running and do the ns lookup?
>
> I'm sorry if this question has been asked and answered before but I
couldn't
> find an answer anywhere else... and the archive for this list seems to be
> down.
>
> Jordan


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to